title: How to hide the next button when no pages to dispaly
body: <p>Can someone help me please? I am sure it is easy for you guys. I am battling to find a solution on how to hide the next link when there are no pages to display my code is as follows:</p>
  
  <pre class="lang-php prettyprint-override"><code>if (!isset($_GET['page']) or !is_numeric($_GET['page'])) {
      $page = 0;
  } else {
      $page = (int)$_GET['page'];
  }
  $pages_query=mysql_query ("SELECT COUNT * FROM hardware");
  $result = mysql_query("SELECT * FROM hardware LIMIT $page, 3");
  echo '&lt;a href="'.$_SERVER['PHP_SELF'].'?page='.($page+3).'"&gt;Next&lt;/a&gt;&lt;p&gt;';
  $prev = $page - 3;
  
  //only print a "Previous" link if a "Next" was clicked
  if ($prev &gt;= 0) {
      echo '&lt;a href="'.$_SERVER['PHP_SELF'].'?page='.$prev.'"&gt;Previous&lt;/a&gt;';
  
  }
  </code></pre>