Thursday, March 17, 2011

The code for your Inventory using PHP

I have been browsing the inter webs and have come across a code for inventory...a simple place to begin gathering a larger picture...

$invsize = 10;
if (mysql_num_rows(mysql_query("SELECT * FROM INVENTORY WHERE user=USERID")) < $invsize){
echo 'You still have inventory space';
}
else {
echo 'Your inventory is full!';
}

That will hopefully help in the near future....

And if you want to get an item from a users inventory...just query the USERID up like this
php
mysql_query("SELECT * FROM items WHERE userid=1515");

A skill for the rogues perhaps?

No comments:

Post a Comment