Navigation Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
Could any one please help me with Page Navigation. I have done Next and Previous page Navigation but confused on printing page numbers (1,2,3,4) and hyperlink them. Below is the code which i'm halfway on but it only prints "1" with no hyperlink where as I have 11 pages, if i print $noPages.
Could you please correct where i'm mistaking.
 $result = safe_query("select count(*) FROM gig g, venue v WHERE g.gigName LIKE '%".$gig_name."%' ");
 $noEntries = mysql_num_rows($result);
 $noPages = ceil($noEntries / $limit);
  $currentPage = 0;
 if(isset($_GET['pag']) && 
    is_numeric($_GET['pag']) && 
    $_GET['pag'] > 0 && 
    $_GET['pag'] < $noPages){
    
        $currentPage = $_GET['pag'];
 }
 $start = $currentPage * $pageLimit;
  $sqlTotal = "select * FROM gig g, venue v WHERE g.gigName LIKE '%".$gig_name."%' ".$start.",".$limit;
 for($a = 0; $a < $noPages; $a++){
    if($currentPage == $a){ 
        echo($a+1);
    }else{
        echo '<a href="'.$_SERVER['PHP_SELF'].'?spag='.$a.'">'.($a+1).'</a>';
    }
    if($a < $noPages - 1){
        echo '-';
    }
}


      

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux