Jump to content

Deleting code still not working!


Jurik

Recommended Posts

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>

<?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>
[/code]
Link to comment
Share on other sites

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");
}
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.