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
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());

Link to comment
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 :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.