Bizarre SQl, if issue....

From: Date: Tue, 29 Jul 2003 17:29:10 +0000
Subject: Bizarre SQl, if issue....
Groups: php.general 
Request: Send a blank email to php-general+get-157342@lists.php.net to get a copy of this message
Hey, I've got a weird issue. I have some code, an MySQL statement, that returns an empty set, like this: $person = mysql_query("Some Statement Here"); So, then I have an if/else statement: if (!$person || $person == 0 || $person == '' || $person == '0') { $result = 1; } else { $result = 4; } If the SQL statement returns an empty set, shouldn't $result be equal to 1? Instead, I'm getting $result = 4. Hence all of the 'OR' conditions. I would have have thought !$person would be enough. Thanks for any input! :) -Mike

« previous php.general (#157342) next »