title: Next previous image?
body: <p>Im trying to make a album with next/previous image.
  Could I do something like this or isnt this a good idea? I dont really know how it could be done any other way. </p>
  
  <pre><code>&lt;?php
      $imgnl = $_POST['next'];
      $imgnl = $_POST['last'];
  
      if($imgnl == "next"){
  
      $result=mysqli_query($con, "SELECT * FROM album WHERE user_id='$id AND (added&gt;'$currentimg') LIMIT 1");
      $row=mysqli_fetch_array($result);
  
      $currentimg = row['added']; // Y-m-d H:i:s
      $url = row['url'];
  
      }else if($imgnl == "last"){
      $result=mysqli_query($con, "SELECT * FROM album WHERE user_id='$id AND (added&lt;'$currentimg') LIMIT 1");
      $row=mysqli_fetch_array($result);
  
      $currentimg = row['added']; // Y-m-d H:i:s
      $url = row['url'];
      }
      else{
          $result=mysqli_query($con, "SELECT * FROM album WHERE user_id='$id ORDER BY added ASC LIMIT 1");
          $row=mysqli_fetch_array($result);
          $currentimg = row['added']; // Y-m-d H:i:s
          $url = row['url'];
      }
  ?&gt;
      &lt;img src $url ......
  </code></pre>