I am using a mysql database, just for heads up. I have a small gallery that is displaying 2 images at a time. I have two arrows image, one left and one right. The right image, when clicked, takes you to the next id in line and it works fine. My issue is the left arrow, when clicked, does not take you to the previous id, rather it takes you to the very first id. Any thoughts?
$prodID = $_GET['prodID'];
$prevItem = sprintf("SELECT id
WHERE id<%d", $prodID);
$itemPrev = mysql_query($prevItem) or die("Previous item was not grabbed because: " . mysql_error());
$p = mysql_fetch_array($itemPrev);
$prevID = $p['id'];
echo "<div class='sidebarimagewrap'>" . (empty($prevID) ? "<span class='sidebararrowlf'></span>" : "<a href='/view-product-SL.php?prodID=$prevID'><img class='sidebararrowlf' src='images/btn-arrow-sidebar-lf.png' alt='' /></a>");