|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9306 while and multiple conditions
Submitted: 2001-02-16 15:47 UTC Modified: 2001-04-29 22:18 UTC
From: bjartebe at eunet dot no Assigned:
Status: Closed Package: Unknown/Other Function
PHP Version: 4.0.1pl2 OS: linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: bjartebe at eunet dot no
New email:
PHP Version: OS:


 [2001-02-16 15:47 UTC] bjartebe at eunet dot no
		$i = 0;
		$NR_CASES = 5;

		while( $row = mysql_fetch_object($queryh, MYSQL_ASSOC) && $i < $NR_CASES ) {
			<tr align="left">
					<FONT SIZE = "2">
					<?	echo $i . ": " . $row->head; ?> 

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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-28 13:57 UTC]
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 )


 [2010-05-24 12:46 UTC] samsung_0101 at rediffmail dot com
'while( $row = mysql.........' 
 in this , i think '=' is a assignment, 
for checking whether it is 'equal' you should use '=='.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jul 24 09:01:30 2024 UTC