Page 1 of 1

prev and next issues

Posted: Sat Aug 24, 2002 8:31 am
by Russ
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))&#123;echo ( "<br><b><a href=?action=view&id=" .$myrow&#1111;id]. " class=link>" . $myrow&#1111;'headband'] . "</a></b> @ " .$myrow&#1111;'venue']. " - " . date("F j, Y", strtotime($myrow&#1111;'date'])) . "");
&#125;

$query="SELECT count(*) as count FROM gigdb"; 

  $result=mysql_query($query);

  $row=mysql_fetch_array($result);

  $numrows=$row&#1111;'count'];



echo "<p>";

  if($start>0)&#123;echo "<a href=?action=sortby&char=".strtoupper($_GET&#1111;'char'])."&start=".($start - 15)." class=link>Previous</a> ";&#125;



if($numrows > ($start + 15)) 

   echo("<a href=?action=sortby&char=" .strtoupper($_GET&#1111;'char']). "&start=" . ($start + 15) . " class=link>Next</a>");

&#125;