title: Prev and next button for database results
body: <p>I would like to build "Previous &amp; Next" links to show records of my database, through pagination.
  The connection is working fine. I just don't know how to build such links.
  How can I do that?</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;test_page&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;table width = "100%"&gt;&lt;tr&gt;&lt;td width="100%" align = "center"&gt;
  &lt;?php
  $userName = "root";
  $pass = "";
  $hostname = "localhost";
  $conn = mysqli_connect($hostname, $userName, $pass) 
  or die ("Nije uspostavljena veza sa Vasim mySQL serverom! &lt;br /&gt;\n");
  echo "Konekcija je uspostavljena! &lt;br /&gt;\n";
  mysqli_select_db($conn, 'vulkan')
  or die ("Ne mogu da nadjem zadatu bazu! &lt;br /&gt;\n");
  echo ("Baza je pronadjena! &lt;br /&gt;\n");
  echo "&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;";
  $id=$_GET['id'];
  $currentid=$id;
  $result = mysqli_query($conn, "select * from ploce_pod where id=$currentid");
  while ($row = mysqli_fetch_array($result))
  {
  $currentid=$row['id'];
  }
  $resultPrev = mysqli_query($conn, "select * from ploce_pod where id&lt;$currentid 
  LIMIT 1");
  while($prevRow = mysqli_fetch_array($resultPrev))
  {
  $previd = $prevRow['id'];
  }
  $resultNext = mysqli_query($conn, "select * from ploce_pod where id&gt;$currentid 
  LIMIT 1");
  while($nextRow = mysqli_fetch_array($resultNext))
  {
  $nextid = $nextRow['id'];
  }
  //here is print table, this is OK
  mysqli_close($conn);
  echo ("Baza je otkacena! &lt;br /&gt;\n");
  ?&gt;
  &lt;p&gt;
  &lt;a href="Index.php?id=&lt;?php echo $previd; ?&gt;"&gt;prethodni&lt;/a&gt;
  &lt;a href="Index.php?id=&lt;?php echo $nextid; ?&gt;"&gt;sledeci&lt;/a&gt;
  &lt;/p&gt;
  &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>