prev and next issues
Posted: Sat Aug 24, 2002 8:31 am
I got a prev and next link tutoral from a site, it works fine, but when I'm displaying the rows beginning with say A, and I want it so if there is more than 15 A's the prev and next links show, the count just counts how many rows there are in the database, and no how many A's there are, also, is there away of changing it, so instead of having prev and next, I have page 1 | 2 | 3 | 4 etc and it says displaying 15 of 20 reviews beginning with A
Code: Select all
if(isset($_GETї'start'])){$start=$_GETї'start'];}else{$start=0;}
$result=mysql_query("select * FROM gigdb WHERE headband LIKE '".strtoupper($_GETї'char'])."%' ORDER BY headband ASC LIMIT " .$start.", 15",$db);
{
while($myrow=mysql_fetch_array($result)){echo ( "<br><b><a href=?action=view&id=" .$myrowїid]. " class=link>" . $myrowї'headband'] . "</a></b> @ " .$myrowї'venue']. " - " . date("F j, Y", strtotime($myrowї'date'])) . "");
}
$query="SELECT count(*) as count FROM gigdb";
$result=mysql_query($query);
$row=mysql_fetch_array($result);
$numrows=$rowї'count'];
echo "<p>";
if($start>0){echo "<a href=?action=sortby&char=".strtoupper($_GETї'char'])."&start=".($start - 15)." class=link>Previous</a> ";}
if($numrows > ($start + 15))
echo("<a href=?action=sortby&char=" .strtoupper($_GETї'char']). "&start=" . ($start + 15) . " class=link>Next</a>");
}