Grow your CSS skills. Land your dream job.

how to unlink multiple images !!

  • # May 19, 2011 at 5:33 pm

    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










    < ?php echo $name; ?>


    delete_ac.php


    < ?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 …

    # May 20, 2011 at 7:37 am

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

    # May 20, 2011 at 8:25 am

    that’s right and i delete before unlink ..

    now every thing is OK..

    thanx lyleyboy ..

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".