I am trying to store some data in database but could not figure out how the database should be designed for maximum productivity…
User has an option to choose number of entries in a form. And then these entries are required to be saved in the database. It is however not known how many entries the user wants e.g they can be 1 or 100.
How is it better to save such data?
What i have in mind is to store the number of entries in database with the userID and put the inputs into an array, serialize it and store it in the database.
I would probably do the following:
The
entriestable storesnentries for each user associated with theuser_idwhich is a FK (foreign key) reference to the PK (primary key) columnidof tableusers. When you want to retrieve the data you can fire a select query as follows to get the entries for a particular user.