[PHP-DEV] PHP 4.0 Bug #9482: || operator gives unexpected results From: ssegarra <email protected>
Date: 02/27/01

From: ssegarra <email protected>
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

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>