wmguk Posted May 22, 2008 Share Posted May 22, 2008 hey guys, I have googled unlink, and I think this is the thing I need.. Basically I have a delete button, when clicked it removes a row from the database where login = $login and that works, however i also need to remove all files within clients/$login I cannot see the context for *.* can anyone suggest a way to empty a directory and then delete that directory? I have this so far: <?PHP //Get the data to update $login = $_POST['login']; $thisdir = "/var/www/vhosts/domain.co.uk/httpdocs/clients"; // Make Connection include 'connection.php'; if (!$con) { die('Could not connect: ' . mysql_error() ); } mysql_select_db($db, $con); //Run the update query $sql = "DELETE FROM album WHERE login = '$login'"; mysql_query( $sql , $con ) or die( "<strong>Query Error</strong>: " . mysql_error() . "<br><strong>Query</strong>: $sql<br><br>" ); unlink ($thisdir ."/login", *.*); //I dont think *.* will work? rmdir($thisdir ."/$login"); //Close the connection mysql_close($con); ?> <META HTTP-EQUIV="Refresh" CONTENT="0; URL=../display.php"> Link to comment https://forums.phpfreaks.com/topic/106853-removing-all-files-within-a-specified-directory-unlink/ Share on other sites More sharing options...
wmguk Posted May 23, 2008 Author Share Posted May 23, 2008 any thoughts? Link to comment https://forums.phpfreaks.com/topic/106853-removing-all-files-within-a-specified-directory-unlink/#findComment-547796 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.