Jump to content


Photo

Deleting code still not working!


  • Please log in to reply
1 reply to this topic

#1 Jurik

Jurik
  • Members
  • PipPipPip
  • Advanced Member
  • 59 posts

Posted 26 October 2006 - 01:24 PM

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

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


and this error im guessing will be fixed once the above error is fixed

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


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.

<!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>

<?php

if (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>


#2 xyn

xyn
  • Members
  • PipPipPip
  • Advanced Member
  • 779 posts
  • LocationNorthampton

Posted 26 October 2006 - 01:33 PM

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");
}




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users