I'm trying to put limit of data fetch as well as dynamic navigation. Below is 
the try which I did but something is going wrong as $screen value is not 
increasing so when I click on NEXt button it refreshes the same page and 
Previous button does even show.

Could you kindly have look on the coding and help me where i'm mistaking.



$rows_per_page = 10;
if (!isset($screen))
$start = $screen * $rows_per_page;
$sql = "SELECT * FROM gig g, venue v WHERE g.gigName LIKE '%".$gig_name."%' OR 
g.gig_date LIKE '%".$sdate."%' OR g.genre LIKE '%".$genre."%' OR g.ticket_price 
LIKE '%".$ticket_price1."%' OR g.ticket_price LIKE '%".$ticket_price2."%' OR 
v.venueName LIKE '%".$vname."%' OR v.vCity LIKE '%".$city."%' order by gig_Date 
LIMIT $start,$rows_per_page";
$result = mysql_query($sql) or die("Query error: ". mysql_error());
$num_rows = mysql_num_rows($result) ;
$pages = ceil($num_rows / $rows_per_page);
while ($row = mysql_fetch_array($result)) 
 global $limit;
 $j = $j+1;
      $gigid = $row['gigid'];
   $gigname = $row['gigName'];
   $sdate = $row['gig_fdate'];
   $fdate =$row['gig_tdate'];
   $genre = $row['genre'];
   $ticket_price = $row['ticket_price'];
   $gigdetail= $gigid;
    echo("<br> $gigid <a href='detail.php?gigDetail=$gigid'>  $gigname</a>");


if ($screen > 0) 
   print <a href=\"view.php?$screen=".( $screen+1)."\">&lt;&lt;Previous 
Entries</a> &nbsp; ";
else if ($screen < $pages)
    $screen = $screen+1;
  print "<a href=\"view.php?screen=".($screen)."\">Next Entries&gt;&gt;</a> 
&nbsp; ";


You rock. That's why Blockbuster's offering you one month of Blockbuster Total 
Access, No Cost.  

Reply via email to