Posts

Showing posts from April, 2012

Pagination In Website Using Arrays / Php / Javascript Example Code

Hi, Pagination in a database based website is very much important in order to include all the entries in the web page.the following give a way to include pagination in your web page through Arrays $result = mysql_query(“select * from tablename where conditions (optional)”); if(mysql_num_rows($result)>0) {$i=0 ; while($row=mysql_fetch_array(result)) { $array[$i][0]=$row["fieldname1"]; //fieldname reprsents the arrtibute name in the table $array[$i][1]=$row["fieldname2"]; $array[$i][2]=$row["fieldname3"]; $array[$i][3]=$row["fieldname4"]; $array[$i][4]=$row["fieldname5"]; //place as much information to be displayed in the array here ‘a’ $i++; } } $total_pages = mysql_num_rows($result); echo “Total “.$total_pages.” results found”; $targetpage = “your current page?parametes that you are sending from previous page”; /* Place code to connect to your DB here. */ //include(‘dbconnect.php’); // include your code t...