|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #60191 wrong result
Submitted: 2011-11-01 13:25 UTC Modified: 2011-11-01 14:56 UTC
From: j dot veder at advanceu dot nl Assigned: danbrown (profile)
Status: No Feedback Package: *General Issues
PHP Version: Irrelevant OS: windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: j dot veder at advanceu dot nl
New email:
PHP Version: OS:


 [2011-11-01 13:25 UTC] j dot veder at advanceu dot nl
From manual page:
$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:
$result = mysql_query('SELECT * WHERE 1=1');
if (!$result) {
    die('Invalid query: ' . mysql_error());


Expected result:

Actual result:
result resource(7)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-11-01 13:36 UTC] anon at anon dot anon
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".
 [2011-11-01 14:50 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: danbrown
 [2011-11-01 14:56 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:

$result = @mysql_query('SELECT * WHERE 1=1');

$ php kjh.php 

What do you see when you run the code exactly as shown above?
 [2011-11-01 14:56 UTC]
-Status: Feedback +Status: No Feedback
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 28 10:01:31 2024 UTC