Jump to content

Archived

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

Leovenous

Resource id #18

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?

Share this post


Link to post
Share on other sites
Try:
[code]print_r($result);[/code]

Orio.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
[code]$rows = mysql_fetch_array($result);[/code]
Is for calling one/zero row, if you want to call more more rows, you need to use while loop.

There's a FAQ which is sticky, try reading there. It has examples.

Share this post


Link to post
Share on other sites

×

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.