php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10389 mysql_query(); returns an invalid result resource
Submitted: 2001-04-18 19:45 UTC Modified: 2001-05-10 05:51 UTC
From: pmarks at employees dot org Assigned:
Status: Closed Package: MySQL related
PHP Version: 4.0.4pl1 OS: Linux
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: pmarks at employees dot org
New email:
PHP Version: OS:

 

 [2001-04-18 19:45 UTC] pmarks at employees dot org
Here is the code I am using that produces the error:

<?php
    $db = mysql_connect("localhost");
    mysql_select_db("ue", $db);
    $result = mysql_query("SELECT * FROM jobsc");
    $rows = mysql_num_rows($result);
?>

on the last line is where the error is generated.  In
any browser, I see:

Warning: Supplied argument is not a valid MySQL result
resource ...

My setup contains apache 1.3.19 with the static PHP 4.0.4pl1
module compiled in.  My configure lines for PHP are:

./configure --with-apache=/home/apache_1.3.19
--with-mysql=/usr/local/mysql

/usr/local/mysql is the install directory for mysql

That is all the information I believe I have, and I'm
relatively sure that PHP is not crashing, per say.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-18 20:26 UTC] cnewbill@php.net
Your query is not returning any rows, and as such mysql_query returns false.  False of course is not a valid mysql result and thus the "Warning".

If you are 100% certain the query returns results then that would be a problem, otherwise this is not a bug.

Please check this query from the mysql command line and reopen if there really is a problem.

-Chris
 [2001-04-18 20:29 UTC] cnewbill@php.net
My bad...it would not return false.  It's been a long long day.

But it would return false if the table jobsc did not exist or the database ue did not exist.

-Chris

 [2001-04-19 16:42 UTC] pmarks at employees dot org
I checked what you said with mysqladmin and mysql.  The
database "ue" does exist, as does the table "jobsc."  Thanks
for saying something about the table being empty, as it was.
I fixed this problem (I'd had it before, but i just did this new
script by itself to make sure) and added 1 entry to the table "jobsc."  PHP4 still returns the same warning as before on the
"SELECT * FROM jobsc"  and in the mysql console, executing
that instruction returns the one and only row in the table jobsc.
 [2001-04-19 17:40 UTC] cnewbill@php.net
This appears to be related to 4.0.4pl1.  I can reproduce it on a 4.0.4pl1 box, but not anything newer.

Can you try 4.0.5 or a CVS snapshot? http://snaps.php.net/

-Chris
 [2001-05-10 05:51 UTC] sniper@php.net
Can't reproduce. If still problem with latest CVS, reopen.

--Jani

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jun 30 19:01:35 2025 UTC