Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End how to unlink multiple images !!

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #32797
    The-Marshal
    Member

    Hi ,

    Can you tell me how to unlink multiple images to the same section…

    Like :

    Products -> iphone

    the iphone section have 10 images when i delete this section , all images related to this

    section be deleted ..

    this is my code but but i don’t know where the problem

    delete.php












    delete_ac.php



    #### Checkbox Elements .
    $id = $_POST;
    if (isset($_POST))
    {
    $impid = implode(",", $id);
    $Qdell2 = mysql_query("SELECT * FROM salle WHERE sal_id IN(".$impid.")") or die (mysql_error());
    $Qdell = mysql_query("DELETE FROM salle WHERE sal_id IN(".$impid.")") or die (mysql_error());

    $row2 = mysql_fetch_object($Qdell2);
    $mainOrignal = $row2->mainOrignal;
    $path2 ="../../wed/upload/Sall/";
    @unlink($path2.$mainOrignal);

    //
    +
    $QdellPic = mysql_query("SELECT * FROM pics WHERE salle_id IN(".$impid.")") or die (mysql_error());
    $QdellPic2 = mysql_query("DELETE FROM pics WHERE salle_id IN(".$impid.")") or die (mysql_error());

    $row = mysql_fetch_object($QdellPic);
    $th = $row->thum;
    $ori = $row->orignal;
    $path ="../../wed/thumb_ori_Img/Sall/";
    @unlink($path.$th);
    @unlink($path.$ori);

    //
    +
    if (isset($Qdell) && isset($QdellPic2)) {
    redirect_to("../index.php?up=delete");
    }
    }

    but delete one image only

    any help i appreciated …

    #75640
    lyleyboy
    Member

    You need to loop through the records deleting each image in turn.

    #75644
    The-Marshal
    Member

    that’s right and i delete before unlink ..

    now every thing is OK..

    thanx lyleyboy ..

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.