Page 1 of 1

little help with php

Posted: Fri Aug 30, 2013 3:10 pm
by kierongi
just a quick question guys:

lets say for instance i buy 5 health potions

and i want to set a limit of 5 item in the inventory

i have tried to use statements such as:

if ('inventory' > 5)
{
echo "Your items list is full either use or sell to make this purchase";
echo "<center><a href='index.php'>Go Back</center></a>";
exit;
}

but this is not working i am sure that i will either have to add a counter into the database or something like that

Re: Limit a item (PHP)

Posted: Fri Aug 30, 2013 3:17 pm
by vitinho444
When you buy a potion, do you add it to the inventory right?
so just do:

Code: Select all

if(iventory["potions"] > 4)
{
//players has 5 potions or more
}
 

Re: Limit a item (PHP)

Posted: Fri Aug 30, 2013 3:38 pm
by kierongi
cheers vitinho444 had to add another query for it to work