Doc #60191 [Com]: wrong result

From: Date: Tue, 01 Nov 2011 13:36:30 +0000
Subject: Doc #60191 [Com]: wrong result
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-7369@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=60191&edit=1 ID: 60191 Comment by: anon at anon dot anon Reported by: j dot veder at advanceu dot nl Summary: wrong result Status: Open Type: Documentation Problem Package: *General Issues Operating System: windows PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Tried it, and I get "false", and "Invalid query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE 1=1' at line 1". Previous Comments: ------------------------------------------------------------------------ [2011-11-01 13:25:39] j dot veder at advanceu dot nl Description: ------------ --- From manual page: http://www.php.net/function.mysql-query#refsect1-function.mysql-query-examples --- <?php $result = mysql_query('SELECT * WHERE 1=1'); if (!$result) {//this does not return false ever!!!!!!!!! returns on fail: 'result resource(7)' after mysql_fetch_assoc() returns bool(false) die('Invalid query: ' . mysql_error()); } ?> Test script: --------------- <?php $result = mysql_query('SELECT * WHERE 1=1'); print_r($result); if (!$result) { die('Invalid query: ' . mysql_error()); } ?> Expected result: ---------------- false Actual result: -------------- result resource(7) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60191&edit=1

« previous php.doc.bugs (#7369) next »