Jump to content
MakeWebGames

Recommended Posts

Posted

Ok this is driving me banana's, but I cannot get a script to work.

I'm trying to set it up so that when you use an item, it redirects you to a diferent page. (I already figured that out lol)

Once at the page, I would love for the page to check the persons inventory to see if that item is there, and if it is...allow the user to use the page.

Something on the lines of

$i=$db->query("SELECT iv.*,i.*,it.* FROM inventory iv LEFT JOIN items i ON iv.inv_itemid=i.itmid LEFT JOIN itemtypes it ON i.itmtype=it.itmtypeid WHERE iv.inv_id={$_GET[iD]} AND iv.inv_userid=$userid");

}

if(!$db->num_rows($i)) { print "<h2>Oops</h2>Invalid item ID"; }

else

{

$r=$db->fetch_row($i);

if($r[itmid] == 20)

then afterwards you can have access to the page.

Pretty much, I'm trying to make it required to have a mining pick before going mining

Posted

Re: Need an item to access a page

 

$itemid = 1;
	$i=$db->query("SELECT * FROM inventory WHERE inv_itemid=$itemid AND inv_userid=$userid");
if(mysql_num_rows($i) == 0)
{
print "<h2>Oops</h2>Invalid item ID";
$h->endpage();
exit;
}

 

Try that, change 1 to the item id required.

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.

×
×
  • Create New...