Jump to content

Need Help During Deleting File From Server After Deleting From Db


rootKID

Recommended Posts

Hello. My name is rootkid, and after i have deleted a picture name from my database. then it wont delete the file in real from my server/Folder... and that is going to fill out ALOT of space... any ideas on how to delete it? Need anything. then tell me what you will need... i dont know what information i need to give out... (it is localhost im using on my normal pc/windows...) Hoping a answer soon....

Link to comment
Share on other sites

sorry for late reply, i have half way exams on my school -.- but yes, that is also the thing i did, here is the code below:

<?PHPinclude ("secure.php");include ("../conn/db.inc.php");?> <?phpif(isset($_POST['Submit'])){$pid = $_GET['p_id'];$query="DELETE FROM produkter WHERE p_id=$pid"; //Ingen 1 plinger vis Rowen i DB er INT(11)mysql_query($query);$query5=" SELECT * FROM produkter WHERE p_id='$pid'";$result5=mysql_query($query5);while ($row1 = mysql_fetch_array($result5, MYSQL_ASSOC)){$myFile2 = "../personale_b/".$row1['billede']; //HUSK AT DETTE ER BILLEDERNES DB STI I VARE/PRODUKT DB...unlink($myFile2);}$query1=" DELETE FROM produkter WHERE p_id='$pid'";mysql_query($query1);mysql_close();header("location:vare_list.php");}//Submit ######...?>  <fieldset><legend>Slet Vare???</legend><form id="form1" name="form1" method="post" action=""><table width="500" boder="0" cellspacing="1" cellpadding="0" ><tr>	 <td> </td>	    <td>Er du sikker du vil slette Dette Personale medlem?</td>	    <td> </td>	    </tr>	    <tr>	    <td> </td>	    <td><label>	    <input type="submit" name="Submit" id="Submit" value="slet" />	    </label></td>	    <td> </td>	    </tr>	    <tr>	    <td> </td>	    <td> </td>	    <td> </td>	    </tr>	    <tr>	    <td><a href="vare_list.php">Tilbage Til Listen</a></td>	    <td> </td>	    <td> </td>	    </tr>	    <tr>	    <td><a href="index.php">Til Site Admin</a></td>	    <td> </td>	    <td> </td>	    </tr>	    </table>	    </form></fieldset>

Hope this helps, and nope, this one is not finished yet. i got the finished one on my home pc, its because im in schools and dosent have the done work on that pc, (i can republish tonight if it is... just tell me...)

Link to comment
Share on other sites

you had deleted the db entry first then tried to pull the data. probably the select query is not reurning anything. First get the datbase entry then delte the file in filesystem after that delete the entry from database should work.

Link to comment
Share on other sites

thanks. will try and then return with an answer if it worked. thanks alot. :D.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...