hello, i would like to put a next/prev page with numbers to my page, since my query return lot of page, i dont want to display all the pages, but something like (on first page, assuming i got 16 pages of result)
[ (1) 2 3 4 ... 16 ] -> next
when i click on page four it change to:
previous <- [ 1 ... 3 (4) 5 ... 16] -> next
and on page fifteen:
previous <- [ 1 ... 13 14 (15) 16] -> next
and so
<?
if ($offset!=0) { // bypass PREV link if offset is 0
$prevoffset=$offset-$limit;
print "<a href=\"$PHP_SELF?offset=$prevoffset\"><<previous</a> \n";
}
$pages=intval($numrows/$limit);
if ($numrows%$limit) {
// has remainder so add one page
$pages++;
}
print "</td><td align=center >[ ";
for ($g=1;$g<=$pages;$g++) { // loop thru
$newoffset=$limit*($g-1);
if ($newoffset==$offset) {print "<b>$g</b> ";}
else {print "<a href=\"$PHP_SELF?offset=$newoffset\">$g</a> \n";}
}
print "]</td><td align=left width=33%> ";
if (!(($offset/$limit)==($pages-1)) && $pages!=0) {
//print "$offset - $limit - $pages";
// not last page so give NEXT link
$newoffset=$offset+$limit;
print "<a href=\"$PHP_SELF?offset=$newoffset\">next >></a>\n";
}
?>
any clues to change the code to fit what i would like?
thanks in advance