PHP 4.0 Bug #9482: || operator gives unexpected results

From: Date: Tue, 27 Feb 2001 15:52:12 +0000
Subject: PHP 4.0 Bug #9482: || operator gives unexpected results
Groups: php.dev 
Request: Send a blank email to php-dev+get-47627@lists.php.net to get a copy of this message
From: ssegarra@mitre.org Operating system: red hat 6.2 PHP version: 4.0.4pl1 PHP Bug Type: *General Issues Bug description: || operator gives unexpected results <? $db = mysql_connect("localhost", "web") || print "error connecting ".mysql_error()." ".mysql_errno(); mysql_select_db("surveys"); $result = mysql_query("select * from attract") || print "error querying ".mysql_error()." ".mysql_errno(); $i = 0; while ($row = mysql_fetch_array($result)){ // && ($i++ < 5)){ echo $row[0]." ".$row[1]."<br>"; } ?> this script will repeatedly give me invalid MySQL Link Resource Warnings, but by changing the "||" to "or" it will work fine. Thanks -- Edit Bug report at: http://bugs.php.net/?id=9482&edit=1

« previous php.dev (#47627) next »