Edit report at http://bugs.php.net/bug.php?id=9306&edit=1

 ID:               9306
 Comment by:       samsung_0101 at rediffmail dot com
 Reported by:      bjartebe at eunet dot no
 Summary:          while and multiple conditions
 Status:           Closed
 Type:             Bug
 Package:          Unknown/Other Function
 Operating System: linux
 PHP Version:      4.0.1pl2

 New Comment:

'while( $row = mysql.........' 

 in this , i think '=' is a assignment, 

for checking whether it is 'equal' you should use '=='.


Previous Comments:
------------------------------------------------------------------------
[2001-04-28 13:57:43] eli...@php.net

I believe this is because of operator precedence.  "=" has a lower
precedence than "&&"



Try adding parenthesis to your statement like this:



while( ($row = mysql_fetch_object($queryh, MYSQL_ASSOC)) && $i <
$NR_CASES )



Sean



------------------------------------------------------------------------
[2001-02-16 15:47:22] bjartebe at eunet dot no

                $i = 0;

                $NR_CASES = 5;



                while( $row = mysql_fetch_object($queryh, MYSQL_ASSOC) && $i <
$NR_CASES ) {

                        $i++;

                        ?>

                        <tr align="left">

                                <td>

                                        <FONT SIZE = "2">

                                        <?      echo $i . ": " . $row->head; ?> 

                                        </FONT>

                                </td>

                        </tr>

                        <?

                }



if i dont include && $i < $NR_CASES, $row->head will print.

if i include it (like now), i wont get anything.



wierd huh ?



im sorry i have no clue about the mods etc for php, im not the one who
compiled it here.

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



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=9306&edit=1

Reply via email to