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
https://forums.phpfreaks.com/topic/152540-solved-neep-help/
Share on other sites

Archived

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

×
×
  • 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.