Jump to content
MakeWebGames

Need a little help...


modernmafiia
 Share

Recommended Posts

What am trying to do is code a item function in my gym, basically i have energy potions in my game now what i want to do is select from the inventory the item id from inventory and if you have that item in your inventory you have option in the gym to use it instead of having to go back to inventory and having to keep on using and repeating as it a very long process.

can any one help?

Link to comment
Share on other sites

What am trying to do is code a item function in my gym, basically i have energy potions in my game now what i want to do is select from the inventory the item id from inventory and if you have that item in your inventory you have option in the gym to use it instead of having to go back to inventory and having to keep on using and repeating as it a very long process.

can any one help?

Call your item,inventory,user table in database left join. then make the link to click to use the item on that page, not hard.

Link to comment
Share on other sites

Call your item,inventory,user table in database left join. then make the link to click to use the item on that page, not hard.

I made one for jail keys to show up in the header and didnt use any joins so that is just a little bit more extra than what is required.

All I did what just call out my inventory item id from the inventory table that matches with the item id of the item you want to use cause the itemuse goes off of inventory item id and not item id from the items table.

Example:

$var=mysql_query("SELECT inv_itemid, inv_userid FROM inventory WHERE inv_itemid = #<-item id of what you want here && inv_userid = {$ir['userid']}");
while($var2=$db->fetch_row($var))

Something like this

Link to comment
Share on other sites

i really need help making this query, my item id is 57 im trying to pull that our from users inventory if they have it will display the item and you can use it else it will show and error message

seeing as I just made it for you but here it is again:

$var=mysql_query("SELECT * FROM inventory WHERE inv_itemid = 57 && inv_userid = {$ir['userid']}");
while($var2=$db->fetch_row($var))
if ($ir['jail'])
{
echo "<b>NB:</b> You are currently in jail for {$ir['jail']} minutes.<br />";
if ($db->num_rows($var2) >=1)
{
echo"
You currently have {$var2['inv_qty']} Jail Key(s)<br />
Use your <a href="itemuse.php?ID={$var2['inv_itemid']}">Jail Key</a> to get out<br />";
}	
}

NOTE: This is an example. I have tested this on my localhost and it works for me and it should work for you. Just change the name of the item since I am using it for jail keys.

Edited by KyleMassacre
Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

 Share

×
×
  • Create New...