I have a photo gallery with each images information inserted into a row, and each image has a unique id.
I have a image deletion option above each image. This code that I have deletes the last row in the database for some reason, even though each image corresponds to a unique username.
Can anyone help me with this code and let me know what seems to be the problem, or help me with a row deletion based on unique id.
<?
session_start();
$username = $_SESSION['username'];
if ($_SESSION['logged']!==true)
{
header('location:loginfailed.php');
}
else {
$imageID = $_SESSION['imageID'];
$sql = "DELETE FROM user_photos WHERE imageID=$imageID";
$result = mysql_query($sql);
}
?>
FOR SOME REASON MY CODE DELETES THE LAST ID IN THE DATABASE NO MATTER WHAT PICTURE I CLICK TO DELETE.
The url for the deletion page is a querty URL
delete.php?imageID=$imageID
Someone please help me. It will be most appreciated.