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'); ?> 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() Link to comment https://forums.phpfreaks.com/topic/241524-delete-images-from-folder/#findComment-1240620 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.