php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5529 Supplied argument is not a valid MySQL result resource
Submitted: 2000-07-12 08:38 UTC Modified: 2000-07-12 08:59 UTC
From: jagas at computerconsultant dot net Assigned:
Status: Closed Package: MySQL related
PHP Version: 4.0 Release Candidate 2 OS: Windows NT4
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: jagas at computerconsultant dot net
New email:
PHP Version: OS:

 

 [2000-07-12 08:38 UTC] jagas at computerconsultant dot net
        if ($dbh =  mysql_connect('localhost','root',''))
        {
                $strSQL = "select authorsname,bodytext from stories where id = $storyid";

					mysql_select_db('mydb');
					$stmt = mysql_query($strSQL, $dbh);
        
					$row = mysql_fetch_array($stmt);
    }

Compiled with MySQL

I get an error when I call "$row = mysql_fetch_array($stmt)" . The error is:
Supplied argument is not a valid MySQL result resource in .... on line 9.

This function worked perfectly in PHP 3.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-12 08:48 UTC] jagas at computerconsultant dot net
Sorry. My sql statement was wrong. The variable $storyid had no value hence ...
 [2000-07-12 08:59 UTC] stas at cvs dot php dot net
buggy bug report, close it
 [2003-01-16 13:45 UTC] joachim dot desmedt at meestersites dot be
I have the same problem.

$db = mysql_connect("xxx", "xxx", "xxx") or die ("Sorry.
mysql_select_db("name", $db);
$SQL_statement = "SELECT * FROM iks WHERE voornaam= $naam";
$resultset = mysql_query($SQL_statement);

while($data = mysql_fetch_array($resultset)){
echo $data['voornaam']

}

But I'm sure that $naam has a value.
Help me please!
 [2003-01-16 13:45 UTC] joachim dot desmedt at meestersites dot be
I have the same problem.

$db = mysql_connect("xxx", "xxx", "xxx") or die ("Sorry.
mysql_select_db("name", $db);
$SQL_statement = "SELECT * FROM iks WHERE voornaam= $naam";
$resultset = mysql_query($SQL_statement);

while($data = mysql_fetch_array($resultset)){
echo $data['voornaam']

}

But I'm sure that $naam has a value.
Help me please!
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 19:01:36 2025 UTC