I'm making a browser MMO using PHP and MySQL. I'm hesitating between two ways to implement player inventories :
when crafted/dropped from a monster/found, an item creates a new row in the Items table, storing its type (instance of a dagger, of a potion...), its location (on the ground at tile X:Y ? in player Z's inventory ?) and maybe an additional field or two. An item's listing would look like this :
id=728 ; type=14 ; location="i426" ; special="e8"
(where "i426" would mean "in the inventory of player n°426", and "e8" would mean the item has the enchantment n°8).
Pros : I can store data about each individual item - enchantments, durability, previous owner... Also, the items are easily placed in any location; putting the items in, say, auction houses, comes for free with this system - not to mention crazy possibilities such as items inside items, etc.
Cons : with hundreds of players looting monsters and crafting all day, this quickly creates a huge table, and it seems pretty wasteful. I fear this might slow down the whole game (I'm using a lot of AJAX voodoo) anytime items are involved.or : when a player puts an item in their inventory, that player's inventory field on the database is updated with the new item's type (an integer) being appended at the end, with a delimiter. A typical inventory field would look like this :
"|11|8|27|58|58"
Pros : much less wasteful. An item instance is just a few digits and a delimiter.
Cons : no extra data on items; every instance is the same. Also, dropping an item on a tile means that tile needs its own inventory field - and so on for every possible location of an item. Besides, this method involves juggling with strings anytime an item has to be added/removed, rather than simply deleting a row from the table. Another thing is that a player's inventory can store a variable number of items, so this string has no predictable length.
In a previous project, I used the second method. The first method looks fun, but I'm not sure if it'll agree with our storage space and our server's speed. Which of those methods is most often used in MMOs ? Is it another one altogether ? Are there some pros or cons I've missed ? (I'm sorry if this question is a bit subjective !)