prev and next issues

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Russ
Forum Newbie
Posts: 21
Joined: Tue Jun 25, 2002 3:33 pm

prev and next issues

Post 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;
Post Reply