I am still building a Photo Gallery and am now trying to build a page to delete a complete album. I don't anticipate a problem deleting from the database but I would also like to delete the files from the server without having to go through the one at a time. I have tried this but I get errors saying there is no such file.
$SQL = "SELECT photo_id, photo_thumbnail, photo_filename FROM gallery_photos WHERE photo_category='$category' ORDER by upload_date DESC";
// execute SQL statement
$ret = mysql_db_query($dbname,$SQL,$link);
if (!$ret) { echo( mysql_error()); }
else {
while ($row = mysql_fetch_array($ret)) {
$photo_filename = $row[photo_filename];
$photo_thumbnail = $row[photo_thumbnail];
unlink('../gallery/ . $photo_filename');
unlink('../gallery/thumbs/ . $photo_thumbnail');