Jump to content

Resource id #24 *shrug*


xoligy

Recommended Posts

Ok the query works in phpmyadmin but soon as i add it to the php i get Resource id #24 can someone tell me whats up or explain?

 

What i want, is for the query to count how many of an item the user has so if a user had 10 of id 1 and then 20 of id  5 it would echo the quantity. Im sure i could make it more complecated but i dont think thats necassary  :P

 

Breakdown:

Weapon info is stored in Melee.

Userweapons is how many of each weapon the user has which is matched up to melee "id" via "item_id"

The user is matched by "user_id" and in this query id 1 will be changed to "$id"

 

Hope this makes sense :)

 

$qty = mysql_query("select melee.item, userweapons.item_id, userweapons.qty, userweapons.user_id from melee, userweapons where melee.id = userweapons.item_id and userweapons.user_id=1");
$result = mysql_query($qty) or die(mysql_error());
// Print out the contents of each row into a table 
while($row = mysql_fetch_array($result)){
    echo $row['item_id']. " - ". $row['qty'];
    echo "<br />";
}

Link to comment
https://forums.phpfreaks.com/topic/193329-resource-id-24-shrug/
Share on other sites

$qty = "select melee.item, userweapons.item_id, userweapons.qty, userweapons.user_id from melee, userweapons where melee.id = userweapons.item_id and userweapons.user_id=1";
$result = mysql_query($qty) or die(mysql_error());

 

Thanks Mchl! i'll look it over and see what was wrong :)

 

So adding "mysql_query("")" waws the problem ok lol thanks :)

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.