Jump to content

[SOLVED] Neep help


david212

Recommended Posts

Hello i have written this code, so i upload my pictures to mysql database, and then i want to delete them. I've used function unlink to delete them from the folder, but when i delete the file from folder the name of this file remains in mysql db. How can i delete from folder and mysql my uploaded images??

 

if(isset($_POST["del"])){


$ss = sizeof($_POST["d2"]);

for($i=0;$i<$ss;$i++){


   
$a2 = "DELETE FROM upimgs WHERE id =\"".$_FILES["fl2"]["name"]."\"";
mysql_query($a2);
	unlink("../upl_imgs/".$_POST["d2"][$i]);

}


}

 

then i tried to delete manuallu, for example:

 

$a2 = "DELETE FROM imgs WHERE id ='12'";

 

and this one works fine but i need to delete the same file im deleting from folder using

 

unlink("../upl_imgs/".$_POST["d2"][$i]);

 

Thanx

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.