Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2003
    Posts
    84

    php if statement

    I cannot believe i m asking question about if statement.

    I just coudn't figure out wht it doesnot work.

    if i comment out the || ($i == 0) from the if statement, following codes work, but i dont know why it doesnt work with || ($i == 0)

    <?

    $str = "";
    $col = 3;
    $i = 1;



    $strProduct = array();
    $strProduct[0] = "abc";
    $strProduct[1] = "2233";
    $strProduct[2] = "4444";

    if ((sizeof($strProduct) % $col) == 0) || ($i == 0) // bug here. please help
    {
    $str .= 'tr>td>';
    }
    else
    {
    $str .= 'td>';
    }

    echo $str;
    /**/
    ?>

  2. #2
    Join Date
    Apr 2004
    Posts
    52
    if ((sizeof($strProduct) % $col) == 0 || ($i == 0))

  3. #3
    Join Date
    Dec 2003
    Location
    Karachi, Pakistan
    Posts
    320
    Yes you were missing ) after this statement.
    if ((sizeof($strProduct) % $col) == 0) || ($i == 0)
    Feroz Zahid
    mail@feroz..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •