Hi all,
I got code over the net for paging mysql table, it provides Prev pages Next link at the bottom of the table. However, I have a pretty large table to display (average over 400+ rows). Even when I limited the rows to display 30, It still have over 10 page link display between Prev and Next link. Following are code to display the links
[PHP]
echo "<center>";
// Build First & Previous page Link
if($page > 1){
$prev = ($page - 1);
echo "<a href=\"".$admin_file.".php?op=EventsAdmin&page=1\" ><img src=\"images/dl_arrow.gif\" alt=\""._FIRST."\" title=\""._FIRST."\" border=\"0\"></a> ";
echo " <a href=\"".$admin_file.".php?op=EventsAdmin&page=$pr ev\"><img src=\"images/l_arrow.gif\" alt=\""._PREV."\" title=\""._PREV."\" border=\"0\"></a> ";
}
// for loop to build page links
for($i = 1; $i <= $total_pages; $i++){
if(($page) == $i){
echo " [$i] ";
} else {
echo " <a href=\"".$admin_file.".php?op=EventsAdmin&page=$i\ "> $i </a> ";
}
}
// Build Next & Last page Link
if($page < $total_pages){
$next = ($page + 1);
echo " <a href=\"".$admin_file.".php?op=EventsAdmin&page=$ne xt\"><img src=\"images/r_arrow.gif\" alt=\""._NEXT."\" title=\""._NEXT."\" border=\"0\"></a> ";
$last = $total_pages;
echo " <a href=\"".$admin_file.".php?op=EventsAdmin&page=$la st\"><img src=\"images/dr_arrow.gif\" alt=\""._LASTPAGE."\" title=\""._LASTPAGE."\" border=\"0\"></a>";
echo "</center>";[/PHP]
What I want to do is limited the total number of page link to 5 and only display plus and minus 2 page over the Current Page but not all the pages links.
I don't want to have something like Page x of xxx between the Prev and Next link
Please help or point me to any reference I could study
Thanks in advance