I am starting to develop a multi store shopping cart in php where every user will have a shopping cart under different stores. I would like to know what is the better way to save the shopping cart details like products name, id, price etc, when a user clicks on "Add to Cart". I think we can save it in two ways : a) Session b) Db Table.
Which is the better method to save all these information ? I want to make it as secure as it can be.
Please suggest.
Thanks
You must know the criticality of the data. If you think that the data in your shopping cart is not critical and not needed for multiple sessions that you can just do it with sessions and save some writes to the DB.
Even if you do need a DB you can save some writes and use client side for temp storage and finally move it to your DB with some kind of a syncing mechanism.
But if your data is highly critical and it is mandatory that it persists in multiple sessions then DB would be an ideal choice as it would give you more power over the access to the data and also it will ease the implementation.