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

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -