MySql: Store multiple choice data in database -


I have a list of checkboxes in my form, users can choose either of them, or just all of them.
Think that the user chooses the type of game that he is interested.

I need the best database structure to store this user's selection. So, in the future, I can get all this data.

I think, I can simply store each database (user ID, game) choise as a new line in the database table. But this is confusing me, because the table will spread quickly with just a few users.

Any thoughts, brother?

You can set up several-to-many tables like:

 < Code> Favoritesport ------ id user_id sport_id 1 5 20   

Where is your:

  User ------- ID name 5 Mike Sport ----- ID name 20 football   

This makes sense because a user has many games, and one game has many users.

Comments