|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2011-11-01 13:25 UTC] 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) PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 09 08:00:01 2025 UTC |
You indicate that you were using mysql_fetch_assoc(), yet your code does not show it anywhere. Also, if your test script is exactly as shown, you haven't even created a database link. That said: <?php $result = @mysql_query('SELECT * WHERE 1=1'); die(PHP_EOL.var_dump($result).PHP_EOL); ?> $ php kjh.php bool(false) What do you see when you run the code exactly as shown above?