Jurik Posted October 26, 2006 Share Posted October 26, 2006 Hi guys im back again, I have been unable to solve the problem i am still having with my PHP code not being able to delete the file I am requesting it to, i've pasted all my code below for you to look at, the problem is still when I click the delete link I get the following errors[quote]Warning: chdir(): No such file or directory (errno 2) in c:\documents and settings\administrator\my documents\web pages\st john fisher movie front end v2\delete.php on line 30[/quote]and this error im guessing will be fixed once the above error is fixed[quote]Warning: unlink(): Permission denied in c:\documents and settings\administrator\my documents\web pages\st john fisher movie front end v2\delete.php on line 31[/quote]Now when i go to my database its deleting the correspondind entry in the table but the file is not being deleted, can anyone help? Here is all my code in its entirity.[code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><html><head><?php include "conn.inc.php"; ?><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>St John Fisher Catholic High School</title><META http-equiv=Content-Type content="text/html; charset=iso-8859-1"><META content="St John Fisher Catholic High School" name=keywords><META content="St John Fisher Catholic High School" name=description><META content="Simon Mackness-Pettit, Arutha Studios" name=Author><link type="text/css" rel="stylesheet" href="styles.css"></head><body><?phpif (isset($_GET['ID'])) { $vidID = $_GET['ID'];} else { $vidID = NULL;}$query = "SELECT * FROM videos WHERE ID = ('$vidID')";$result=mysql_query($query);while($row=mysql_fetch_array($result)){ chdir (\\\benin\\videolibrary\\); unlink($Videofile);}$query2 = "DELETE FROM videos WHERE ID = ('$vidID')";$result2 = mysql_query($query2);echo "The video has been deleted.";?><p align="center"><a href="delvideo.php">Back To Video Removal Facility</a></p></body></html>[/code] Quote Link to comment Share on other sites More sharing options...
xyn Posted October 26, 2006 Share Posted October 26, 2006 I have noticed something which i think might be the problem.1. thise line:while($row=mysql_fetch_array($result))should be;while($row=mysql_fetch_row($result))Also, i would try the below code:$query = "SELECT * FROM videos WHERE ID = ('$vidID')";$result=mysql_query($query);if(!mysql_num_rows($result)){echo ('No rows found');exit;}while($row=mysql_fetch_array($result)){ rmdir("beninvideolibrary"); //RMdir(); unlink("$Videofile");} Quote Link to comment 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.