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
little help with php
little help with php
Last edited by kierongi on Fri Aug 30, 2013 8:20 pm, edited 1 time in total.
- vitinho444
- Posts: 2819
- Joined: Mon Mar 21, 2011 4:54 pm
Re: Limit a item (PHP)
When you buy a potion, do you add it to the inventory right?
so just do:
so just do:
Code: Select all
if(iventory["potions"] > 4)
{
//players has 5 potions or more
}
Re: Limit a item (PHP)
cheers vitinho444 had to add another query for it to work