unlink() & rmdir() ... Problems.

From: Date: Mon, 23 Aug 2004 15:57:35 +0000
Subject: unlink() & rmdir() ... Problems.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-194485@lists.php.net to get a copy of this message
Ave, I do not really know what the problem is because I don't get an error, and in fact my scripts execute fine... Except that, niether is the directory deleted, nor is the file deleted. Only corresponding database entries are deleted which I specify in my SQL code. There are 2 different functions in 2 separate places in my File Manager. 1 function deletes the User including his Folder The other deletes a particular file. The code I'm using to delete the User & his Folder is: <?php if($delete_user) { $db = mysql_connect("localhost","usr","pwd"); mysql_select_db("mydb",$db); $sql = "DELETE FROM user where login = '$user'"; $result = mysql_query($sql) or die("There is a problem."); $sql2 = "DELETE FROM file where login = '$user'"; $result2 = mysql_query($sql2) or die("There is a problem."); rmdir (imsafm/$user); echo "<br><b><i><small>User $user deleted.</small></i></b><br>"; } ?> The name of Folder of a user is the same as his Login. Anyhow... The above code doesn¹t generate any error, and in fact does delete the database entries from the table... But it doesn¹t remove the user¹s directory. Why is that? Similarly, this is the code for deleting the file: <?php $db = mysql_connect("localhost","usr","pwd"); mysql_select_db("mydb",$db); $sql = "DELETE FROM file where ID = '$ID'"; $result = mysql_query($sql) or DIE("Cannot Do!"); unlink($P/$F); echo "<center>File Deleted</center>"; ?> Again, no error... The entries in the table get deleted.. But file remains in the directory. Any suggestions?

« previous php.general (#194485) next »