Lo,
Ive been messing with this code:
$numentries=50;
if(!isset($_GET['p'])) {
$p=0;
} else {
$p=$_GET['p'];
}
$order="SELECT * FROM zc_quote ORDER BY thetime";
$order2=mysql_query($order) or die("Could not create navigation<br>".mysql_error());
$count=mysql_num_rows($order2);
$d=0;
$f=0;
$g=1+$d/$numentries;
print "<tr><td width='2'> </td><td class='mainrow'><p class='quotes'>$count quotes listed -- Page: ";
$prev=$p-$numentries;
$next=$p+$numentries;
if($p>=$numentries) {
print "<A class='black' href='quotes.php?p=0'>first</a> ";
print "<A class='black' href='quotes.php?p=$prev'><<</a> ";
}
while($order3=mysql_fetch_array($order2)) {
if($f>=$p-3*$numentries&&$f<=$p+7*$numentries) {
if($f%$numentries==0) {
print "<A class='black' href='quotes.php?p=$d'>$g</a> ";
}
}
$d=$d+1;
$g=1+$d/$numentries;
$f++;
}
if($p<$f-$numentries) {
print " <A class='black' href='quotes.php?p=$next'>>></a>";
$i=floor($g);
$last=$numentries*$i-$numentries;
print " <A class='black' href='quotes.php?p=$last'>last</a></p></td><td width='2'>";
}
print "</td></tr>";
Now it counts the number of records and sets a amount of pages based on $numentries.
but if theres like 3000 entries there are 60 pages. What if i only want to show 10 pagenumbers at once in the navigation. so when i am on page 1 it shows me page 1~10 and when im at page 40 it shows me page 35~45 and when im at page 60 it shows me page 50~60...
Is that easy to make? can it be done with this code? or do i need some other piece.
Thanks in advance!