im trying to delete a picture after i hit delete. it also deletes the database entry. i got the database entry fine, but when it tries to delete the actual file, i get this error.
Warning: Division by zero in /admin.delete.php on line 20
Warning: unlink(jpg): No such file or directory in /admin.delete.php on line 20
Warning: Cannot modify header information - headers already sent by (output started at /admin.delete.php:20) in /admin.delete.php on line 22
the php files are in one directory.. and the images are in a folder called "hosted" right under that. my database is set where the file name is "image_name" and the extension is "image_ext"..
im not sure how to use unlink where i can add the name.ext in it
heres what i have now. i know its messed up..
if($mode == "delete") {
$date = now();
$sql = "DELETE from image where image_id = '$image_id' and image_status='D'";
$result = mysql_query($sql);
$sqldel = unlink(hosted/'$image_name'.'$image_ext'); ///not sure how to add a directory in here, or if im adding the name.ext correctly..
$result = mysql_query($sqldel);
header("location: admin.delete.php");
}
?>