I have created my own simple image gallery but on the page where i have the enlarged image i would like to include links to the next and previous image so the page updates with that image
The bit I am stuck on is preventing the user from going past the first and last reocrd in the database or entering an image id in the address bar that doesn't exist i.e. gallery/image/0 or gallery/image/5343 (which wouldn't exist)
I have got the image to display and I think i can do the bit in between but would appreciatew some help with going beyond the first and last record
here is the code...very simple
<?php
include_once("includes/connection.php");
$id = $_GET['id'];
$query = "SELECT * FROM images WHERE id = '$id'";
$result = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
echo "<img src='/gallery/".$row['image']."'>";
}
?>