I have a little problem, so im trying to make this game with halls tuts and i was working on inventory. TBH i dont like idea that if you buy 20, lets say, daggers when you go to inventory there is 20 daggers displayed. So i was trying to do some kind of stacking. My first idea was simple:
before item will be put into database
ill check if there is an item with the same name already
if there is, i wont add new object but just update "quantity field in old one
...but than i was like hmmm what about randid ? if i do it this way there will be one randid for all daggers in your inventory, is that safe?
My second thought was:
leave it like it is, so create object in database for every dagger you buy and keep them with seperate randid.
change the way of displaying them in inventory. So when you want to check whats in your bag instead of displaying 20 daggers it will count have many daggers you have and display one with 20 in "quantity". But i wasnt sure how to code it and also what will happen if you decide to sell one - which one will it pick up?
HELP
Also im having problem with using "SELECT SUM" I got:
Code: Select all
$totalarmor="SELECT SUM(rating) as armor from playerarmor where equip=1 AND pid='$pid'";
$totalarmor2=mysql_query( $totalarmor) or die("could not get player armor!");could someone clear it out for me ::D

