lucan Posted July 9, 2011 Share Posted July 9, 2011 I am using this code below to delete information which works perfect. How do I delete a file/ image which is in a folder. <?php // Connect to server and select database. mysql_connect("localhost", "", "")or die("cannot connect"); mysql_select_db("stafflog")or die("cannot select DB"); mysql_query("DELETE FROM image WHERE ID = $_GET[id]") or die (mysql_error()); echo "Your information has been DELETED!"; header('Location: index.php'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/241524-delete-images-from-folder/ Share on other sites More sharing options...
QuickOldCar Posted July 9, 2011 Share Posted July 9, 2011 http://php.net/manual/en/function.unlink.php You are going to have to do a SELECT query first to find the images name and location then can do the DELETE query and unlink() Quote Link to comment https://forums.phpfreaks.com/topic/241524-delete-images-from-folder/#findComment-1240620 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.