DeathStar Posted April 12, 2007 Share Posted April 12, 2007 HI i have a script and its not giveing an mysq_error() but this Resource ID #14 HEre is my sql part: $gunfor=mysql_query("SELECT inv_itemid FROM inventory WHERE inv_userid=$userid", $c) or die("Error: gunfor"); $gunfor2=mysql_fetch_array($gunfor, $c); $sm=mysql_query("SELECT * FROM items WHERE itmid={$gunfor2['inv_itemid']} && itmtype=4 ORDER BY itmname ASC", $c) or die("Error: sm"); if (!$_GET['action']) { while($r=mysql_fetch_array($sm) or die("$sm")) { echo "<tr><td>{$r['itmname']}</td><td><a href='?action=buy&gun={$r['itmid']}</td></tr>"; } echo "</table>"; The $c call a global that is the connection to database Link to comment https://forums.phpfreaks.com/topic/46774-resource-id-14/ Share on other sites More sharing options...
corbin Posted April 12, 2007 Share Posted April 12, 2007 Try while($r = mysql_fetch_array($sm)) I think for some reason, when ever it's assigning the variable it's dying, but it's trying to echo out a query result which will be a resource id. Link to comment https://forums.phpfreaks.com/topic/46774-resource-id-14/#findComment-227986 Share on other sites More sharing options...
tauchai83 Posted April 12, 2007 Share Posted April 12, 2007 this means there are something wrong with query...try check the query that you wrote. Incorrect query result in data cannot be fetched correctly. Link to comment https://forums.phpfreaks.com/topic/46774-resource-id-14/#findComment-227989 Share on other sites More sharing options...
corbin Posted April 12, 2007 Share Posted April 12, 2007 "SELECT * FROM items WHERE itmid={$gunfor2['inv_itemid']} && itmtype=4 ORDER BY itmname ASC" MySQL doesn't allow &&. Use AND instead . Link to comment https://forums.phpfreaks.com/topic/46774-resource-id-14/#findComment-227990 Share on other sites More sharing options...
DeathStar Posted April 12, 2007 Author Share Posted April 12, 2007 thats worked... but, not displaying anything now :s Link to comment https://forums.phpfreaks.com/topic/46774-resource-id-14/#findComment-227992 Share on other sites More sharing options...
DeathStar Posted April 12, 2007 Author Share Posted April 12, 2007 Nevermid. I used a $_GET to bypass that THanks everybody! Link to comment https://forums.phpfreaks.com/topic/46774-resource-id-14/#findComment-227994 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.