Here's the code I've got for deleting a record in the MySQL database as well as the image associated with it on the server. The portion that deletes from the database is working perfectly, but I can't get it to delete the image off the server. This is a picture gallery I've created for a client. Getting it to delete the actual image is the last thing keeping me from finishing the project. All and any help is appreciated.
<?
$db_user_name = "**";
$db_database_name = "";
$db_password = "***";
$picture_id = $GET['picture_id'];
$picture_name = $GET['picture_name'];
$picture_url = $title . '.' . $_GET['picture_url'];
mysql_connect( 'localhost', $db_user_name, $db_password) or die('<br>Failed connect: ' . mysql_error());
mysql_select_db($db_database_name) or die('<br>Failed database: ' . mysql_error());
mysql_query("DELETE FROM pg_gallery WHERE picture_id = $picture_id") or die('<br>Failed query: ' . mysql_error());
mysql_close();
unlink('../../images/gallery/'.$picture_url);
echo 'File removed successfully.';
?>