28.07.2015, 11:02
Quote:
I want to script a shop where people can buy different items, now I know how to do this buy I am wondering what would be the best way to store wether someone has bought this item.
Would I just create another table with structure 1 (found below) and fetch all rows of that player or should I use structure 2? structure 1: bought_items: player - itemid structure 2: bought_items: player - item1 - item2 - etc... Thanks for all responses! |
Two tables:
`items` (`id`, `item_name`, ...)
`bought_items` (`player`, `item_id`, ...)
This saves you the effort of having to create a new column every time you introduce a new item which is so much better, believe me.
I would advise using account ids in this instance, because if a user changes their name there would be no need to change the player name on the table (if you are using the player name).