";
if (!isset($_GET['id'])) {
echo "cannot obtain image";
}
?>
ID: ".$image['id']."";
echo "
File Name: ".$image['imagename']."
";
echo "
Upload Date: ".$image['upload']."
";
echo "
Description: ".$image['alt']."
";
?>
Danger zone
";
echo "";
echo "";
// Check if query is set
if (isset($_POST['delete'])) {
// Try deleting image
if(unlink("images/".$image['imagename'])) {
// If deleted, delete from Table
$image_delete_request = "DELETE FROM swag_table WHERE id =".$image['id'];
$image_delete = mysqli_query($conn,$image_delete_request);
if ($image_delete) {
// Deleted image
header("Location:index.php?del=true&id=".$image['id']);
}
}else{
// Could not delete from file
echo "