Jump to content

mysql loop deleting pictures


brem13

Recommended Posts

hey, i have a script where i want to delete pictures if the checkbox is selected, what it does is goes through and sees what checkbox is checked and deleted the field from my database aswell as the pic and thumbnail, it works, but after it deletes the pictures, its not there anymore and gives me an error when it finishes going through the folder looking for the pic even tho its already gone.

 

i guess what i need help with is to have it stop looping after it deletes it

 

here is the code

-------------------------------

foreach($aPics as $PicKey => $picname) {

    if(array_key_exists($PicKey, $aComments)) {

   

    if (isset($delete[$PicKey])){

 

        mysql_query("DELETE FROM $userlow WHERE picture='$picname'") or die(mysql_error());

unlink($picname);

unlink("thumbs/".$picname);

       

  }//end iff

      }//end foreach

 

 

here is the error

--------------------------------

unlink(1234907747.jpg) [function.unlink]: No such file or directory in editgall.php on line 57

 

 

Link to comment
https://forums.phpfreaks.com/topic/148845-mysql-loop-deleting-pictures/
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.