php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13314 Warning: Supplied argument is not a valid MySQL result resource
Submitted: 2001-09-15 04:53 UTC Modified: 2001-09-15 05:20 UTC
From: rex at pregnancy dot org Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.0.6 OS: Red Hat Linux 7.1
Private report: No CVE-ID: None
 [2001-09-15 04:53 UTC] rex at pregnancy dot org
Background:  I am running RH7.1 with MySQL 3.23, PHP-Nuke 5.0, and phpBB 1.4.1 (both Nuke and the BB are using the same database).  After reading through ticket number 10368, I removed PHP4.0.4, and compiled 4.0.6 using --with-mysql=/usr/ --with-apxs

I continue to get the following error:
Warning: Supplied argument is not a valid MySQL result resource.

The code that produces this error is this:
function cookiedecode($user) {
    global $cookie, $prefix;
    $user = base64_decode($user);
    $cookie = explode(":", $user);
    $result = mysql_query("select pass from $prefix"._users." where uname='$cookie[1]'");
     list($pass)= mysql_fetch_row($result);
    if ($cookie[2] == $pass && $pass != "") {
        return $cookie;
    } else {
        unset($user);
        unset($cookie);
    }
}

I have determined that everything works up until the mysql_fetch_row function.  i did this by inserting 
die($result) on the line prior to mysql_fetch_row.
The resulting output is this: Resource id #2
I have been able to run the query inside mysql, and went so far as to have php die at the $cookie[1] and $cookie[2], just to verify that it was looking at the right information.

Any ideas or suggestions as far as this is concerned would be a great help.

Thank you,


--
Rex

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-09-15 05:00 UTC] swm@php.net
Are you connecting to the MySQL database before you execute
your query?
 [2001-09-15 05:11 UTC] rex at pregnancy dot org
i am assuming so, since the site login validates the password against the database.

I just tried adding die($result) immediately preceding the mysql_fetch_row line again and came up with: 
Resource id #2

--
Rex
 [2001-09-15 05:11 UTC] rex at pregnancy dot org
i am assuming so, since the site login validates the password against the database.

I just tried adding die($result) immediately preceding the mysql_fetch_row line again and came up with: 
Resource id #2

--
Rex
 [2001-09-15 05:20 UTC] mfischer@php.net
This is no support forum, ask such questions at php-general@lists.php.net

- Markus
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Oct 04 03:05:53 2022 UTC