I am looking for a way to store items in a database and looking for a good way to do it. So far I have thought of a couple of ideas:
The first is to serialise items and then store them in a table field 'cart' in the customer table.
The second is to create a table specifically for the cart system, and every time a user adds an item to their cart it adds it to the cart table and is assigned to them by their 'userid' from their account (the 'userid' field from 'customers' table), and to then something like 'SELECT * FROM cart WHERE userid = 123 AND content = "newcart"' to bring up the users current cart. Upon transaction I would then have my system alter 'newcart' to 'purchased', ready for a new cart for a future sale. The only problem I see here is over time the table might get very bloated.
I would like to hear others engineering techniques and ideas.