Leovenous Posted June 26, 2006 Share Posted June 26, 2006 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? Quote Link to comment https://forums.phpfreaks.com/topic/12952-resource-id-18/ Share on other sites More sharing options...
Orio Posted June 26, 2006 Share Posted June 26, 2006 Try:[code]print_r($result);[/code]Orio. Quote Link to comment https://forums.phpfreaks.com/topic/12952-resource-id-18/#findComment-49784 Share on other sites More sharing options...
wildteen88 Posted June 26, 2006 Share Posted June 26, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/12952-resource-id-18/#findComment-49788 Share on other sites More sharing options...
Leovenous Posted June 26, 2006 Author Share Posted June 26, 2006 That makes sense. I wondered if it had to do with an array. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/12952-resource-id-18/#findComment-49824 Share on other sites More sharing options...
hackerkts Posted June 27, 2006 Share Posted June 27, 2006 [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. Quote Link to comment https://forums.phpfreaks.com/topic/12952-resource-id-18/#findComment-50004 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.