title: Adding previous(back) and next buttons next to the page numbers PHP
body: <p>I have two tiny little problems;</p>
  
  <p>1 . I want to add a previous / next button into this code
  2 . I want it to only show like max 10 links between previous and next. So if i have 50 numbers/links it will only show 10 of them and not 50 links on the page.</p>
  
  <p>I have searched on the clo</p>
  
  <p>The code works, only need that two options in it.
  Can someone help me out? Thank you !</p>
  
  <pre><code> &lt;?php 
  
          include 'includes/connection.php';  
          $per_page = 8;
  
          $pages_query = mysql_query("SELECT COUNT(`id`) FROM `products`");
          $pages = ceil(mysql_result($pages_query, 0) / $per_page);
  
          $page = (isset($_GET['page'])) ? (int)$_GET['page'] : 1;
          $start = ($page - 1) * $per_page;
  
  
  
          $query = mysql_query("SELECT `name` FROM `products` LIMIT $start, $per_page");
          while ($query_row = mysql_fetch_assoc($query)) {
              echo '&lt;p&gt;', $query_row['name'] ,'&lt;/p&gt;';
          }
  
          if ($pages &gt;= 1 &amp;&amp; $page &lt;= $pages) {
              for ($x=1; $x&lt;=$pages; $x++) { 
                  //echo $x, ' '; 
  
                  echo ($x == $page) ? '&lt;strong&gt;&lt;a href="?page='.$x.'"&gt;'.$x.'&lt;/a&gt;&lt;/strong&gt; ' : '&lt;a href="?page='.$x.'"&gt;'.$x.'&lt;/a&gt; ';
              }
          }else{
              header("location:index.php?page=1");
          }
  
  
      ?&gt;
  </code></pre>