Jump to content

Resource id #18


Leovenous

Recommended Posts

I don't know how much php is involved. This may belong in the SQL area.

Anyway, this frusterates me. Its not unusual for me to encounter resource id issues and hours of searching has yielded very little result. Maybe I have a wrong approach or something, I would like to learn.

So this query:

[code]$query = "SELECT frc_id FROM frc_users WHERE frc_id = '$userid' ";
$result = mysql_query ($query) or die(mysql_error());
echo $query;    
echo $result;[/code]

I get the right query:

[code]SELECT frc_id FROM frc_users WHERE frc_id='2'[/code]

But the result is the resource id #18. What gives?
Link to comment
https://forums.phpfreaks.com/topic/12952-resource-id-18/
Share on other sites

You cant echo $result in its raw state. You have to use a function like mysql_fetch_array in order to get the results. $result justs stores the result resource which is loaded into memory.

So if you do this:
[code]$rows = mysql_fetch_array($result);

echo print_r($rows);[/code]

You'll now see your results.
Link to comment
https://forums.phpfreaks.com/topic/12952-resource-id-18/#findComment-49788
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.