. I have 60 records in my database(mysql).
1-I am displaying 5 records on same page “sortname.php”
2-There are 4 links on this page. “First Preveous 1-60 Next Last”
First will display first 5 records,
Previous will display previous 5 and so on for Next and Last(last 5 records).
If user is on first page the link of Previous and First should be disable
links to displayCode:$result=mysql_query("select name,email,message from guest order by name limit $start,$display"); //query to retrieve 3 fields start from 1 to 5 while($disp=mysql_fetch_array($result)) //display recods { echo "your name is $disp[name]<br>"; echo "your email is $disp[email]<br>"; echo "your messaege is $disp[message]<br><br><br>"; }
I am unable to manage these links for First, Previous, Next LastCode:static $start=1; //variable for start first record $d=mysql_query("select count(*) record from guest"); //retrieve total records from guest table $id=mysql_fetch_array($d); $total=$id[record]; //total records $display=5; // records to display $page=$total/$display; //total pages $page=ceil($page); echo"<a href=sortname.php?start=$start&display=$display>first</a> <a href=sortname.php?start= &display=$display>previous</a> <b>1 to $total</b> <a href=sortname.php?start= &display=$display>next</a> <a href=sortname.php?start=$id&display>last</a>";
I hope you understand my question.




Reply With Quote