2

I am in the process of implementing a favorites system into my web application. Users will be able to favorite which pages they like and these pages will then become visible in the favourites section of their profile.

I need to store a list of their favorites in the mysql database. As they will likely have more than one favorite I will either need to store them in an array or individually in a table called 'favorites'.

Which is the best way to go?

4

1 回答 1

4

I would certainly store them as individual rows of data. Makes it much easier to manipulate at a later date. Makes things such as "Most Favorited" easier, will be easier to index, will make adding/removing individual entries from a user easier and won't be adding much overhead to the size of the table in the database.

于 2012-07-05T08:59:45.827 回答