php - How to hide the next button when no pages to dispaly -
can me please? sure easy guys. battling find solution on how hide next link when there no pages display code follows:
if (!isset($_get['page']) or !is_numeric($_get['page'])) { $page = 0; } else { $page = (int)$_get['page']; } $pages_query=mysql_query ("select count * hardware"); $result = mysql_query("select * hardware limit $page, 3"); echo '<a href="'.$_server['php_self'].'?page='.($page+3).'">next</a><p>'; $prev = $page - 3; //only print "previous" link if "next" clicked if ($prev >= 0) { echo '<a href="'.$_server['php_self'].'?page='.$prev.'">previous</a>'; }
you can use mysql_num_rows($result)
number of records in hardware:
$result = mysql_query("select * hardware limit $page, 3"); $record_count = mysql_num_rows($result); if ($record_count > 1) echo 'next';
Comments
Post a Comment