MySQL Resource id #

15,059

Solution 1

Thats a string conversion of a php resource like your db handle, result from a db query, or a file handle (retunred from fopen). Somewhere you are doing something like

echo $result;

as opposed to

echo $my_info;

Solution 2

That's the string that results when echoing the, uh, result. The solution is to stop echoing it.

Solution 3

if you're getting resource id#, it means that you echo $result.

And on another note: if you need only one value, I'd suggest using the following:

$id_string = mysql_result($result, 0, 'id_string');
Share:
15,059
Jane
Author by

Jane

Updated on June 14, 2022

Comments

  • Jane
    Jane almost 2 years

    I request a password from a remote server, store in a database table and recover it for use in several URL requests, and am able to retrieve xml data which I can then display on my pages.

    This seems to work fine, except in addition to the xml data, the code also seems to output strings that looks like this:

    Resource id #[random number]
    

    Does anyone know what this might be due to?

    My code to recover the password from the db looks like this:

    $result = mysql_query("SELECT * FROM db_table WHERE id=1") 
    or die(mysql_error());  
    
    $row = mysql_fetch_array($result);
    $my_info =  $row['id_string'];
    

    Thanks!