I’m trying to make a “next button” for my database, so i can view one image at a time. However the way i have it right now only changes the url and not actually the image check it out here. It sticks to the image with the highest id on it (87) no matter what the url is. How do i fix this?
this is how my db looks

<?php
require("includes/conn.php");
if (isset($_GET["imagecount"]))
$next = (int)$_GET["imagecount"]; //int is for sql injection
else
$next = 0;
$result = mysql_query("select * from people order by id desc limit $next, 1") or die(mysql_error());
?>
<?php
$result = mysql_query("select * from people order by id desc limit 0, 1 ") or die ("haznot DB: " . mysql_error());
while ($row = mysql_fetch_assoc($result))
{
echo "<img src=\"images/" . $row['filename'] . "\" alt=\"\" /><br />";
}
?>
<a href="images.php?imagecount=<?php echo $next+1; ?>">Next</a>
You want
WHERE id = $nextin your query. Not what you have.Why do you have two mysql queries…