Thread: foreach

Results 1 to 4 of 4
  1. #1
    Delko DJ's Avatar
    Join Date
    Jan 2011
    Gender
    male
    Location
    trolololol
    Posts
    5,162
    Reputation
    224
    Thanks
    324
    My Mood
    Sleepy
    hey

    which of these is correct:

    1)
    [html]if ((isset($_POST['del'])) && $_POST['pergjigje1'] && $_POST['pergjigje2'])
    {
    $d = 0;
    $nd = 0;
    foreach ($_POST['pergjigje1'] as $questionid && $_POST['pergjigje2'] as $aid)
    {
    $sql = "DELETE FROM `enco`.`forum_answer` WHERE question_id = '$questionid' AND a_id = '$aid'";
    if (mysql_query($sql) && mysql_affected_rows()) $d++;
    else $nd++;


    }

    $msg = "Vepra eshte fshire!";
    if($nd) $err = "$nd Vepra nuk eshte fshire!";
    echo "<b>Pergjigja e temes se forumit eshte fshire!</b><br />";
    } [/html]

    or

    2)
    [html]if ((isset($_POST['del'])) && $_POST['pergjigje1'] && $_POST['pergjigje2'])
    {
    $d = 0;
    $nd = 0;
    foreach ($_POST['pergjigje1'] as $questionid AND $_POST['pergjigje2'] as $aid)
    {
    $sql = "DELETE FROM `enco`.`forum_answer` WHERE question_id = '$questionid' AND a_id = '$aid'";
    if (mysql_query($sql) && mysql_affected_rows()) $d++;
    else $nd++;


    }

    $msg = "Vepra eshte fshire!";
    if($nd) $err = "$nd Vepra nuk eshte fshire!";
    echo "<b>Pergjigja e temes se forumit eshte fshire!</b><br />";
    } [/html]



    please answer as soon as possible this is urgent!!!


    bump bump urgent

    bump bump urgentbump bump urbump bubbump bump urgentump bump urgentmp urgentgent

  2. #2
    Saboteur's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Posts
    2,119
    Reputation
    556
    Thanks
    179
    Neither of them are correct!

  3. #3
    Oompa loompa's Avatar
    Join Date
    Apr 2009
    Gender
    male
    Location
    Eindhoven =]
    Posts
    1,440
    Reputation
    84
    Thanks
    205
    My Mood
    Lurking
    yea true, this is the place for this kinda shit. uhuh. yes. please post more codes yes please.





  4. #4
    Smurfyv's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Location
    -
    Posts
    7,702
    Reputation
    144
    Thanks
    481
    Foreign language I dont understand..LOL