php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #4256 MySQL query produces 'not a valid MySQL-Link resource'
Submitted: 2000-04-26 20:05 UTC Modified: 2000-05-30 16:56 UTC
From: mdg1 at engr dot uark dot edu Assigned:
Status: Closed Package: MySQL related
PHP Version: 4.0 Release Candidate 1 OS: Solaris 2.7
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: mdg1 at engr dot uark dot edu
New email:
PHP Version: OS:

 

 [2000-04-26 20:05 UTC] mdg1 at engr dot uark dot edu
My config:
Apache 1.3.12
PHP4 RC1
Solaris 2.7
MySQL 3.22.14-gamma

The following code produces this warning:
"Warning: Supplied argument is not a valid MySQL result resource in /home/mdg1/public_html/newlook/bogus.php on line 6"

When using an older version of Apache/PHP3, the script works just fine... so I've ruled out any MySQL permission problems or other such things.

Interestingly enough, the MySQL log shows that the data *WAS* fetched from the dB, but for some reason you can't get access to the result in PHP...

The code in question:

<?php
$dbh = mysql_connect("host","username","pass");
mysql_select_db("wwwphp");
	
$sectq = mysql_query("select section,tablename from sections order by disporder",$dbh);

while ( $a = mysql_fetch_array($sectq) ) {
	print ($a["section"]."<BR>\n");
}
?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-05-27 16:58 UTC] joey at cvs dot php dot net
What does
print gettype($dbh);
show?

Does this work if you do not specify the handler?
 [2000-05-30 16:56 UTC] joey at cvs dot php dot net
Reporter says bug is gone in release versions.
 [2002-02-08 16:55 UTC] chang at digitalhighway dot net
Bug is still here. I am using Solaris 8 php 4.1.1.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 09 11:01:34 2025 UTC