I need some advice on how to layout the tables for a MySQL database.
I will first describe what I am trying to do:
- I have a table for users. (This covers basic info for now)
- A user will select a certain workout plan (say plan 1-6). Different workout
- The user will then check a number of checkboxes. Say there are 15 checkboxes for the different machines, a user can select however many he/she wants. Let's say the user choose 6 different checkboxes, not necessarily in order. Each checkbox would have a certain ID. Those checkboxes could post a value of 1 to the database if checked
- On the next page a list of every checkbox the user clicked would be generated. Each checkbox has a picture and name associated with it. EX: For gym machines
- Each machine the user chose is displayed along with a certain number of sets that is set by an admin
Each plan has certain workout machines. I was thinking of making a users table and machines table. Each has user_id. So my database would keep track of each machine the user chose.
I already have the layout pretty much done. I just need to know how to layout my tables in the database so I can start populating data dynamically.
Do I just make 1 table for users and ad like 40 different columns? Probably not.
So let's say a user has clicked 6 machines, each of those machines gets a value of 1. Then on the next page each machine with a value of 1 is displayed along with the picture and name associated with that machine. The number of sets will be set by the admin.
And ideas? I can clarify further if needed.
If you want a better idea of what I am doing, take a look at this picture:
This picture shows the page after the user has selected which machines he/she wants. You can see that 12 machines were chosen. So 12 different machines were chosen and they were all listed here.
The sets at the top were created by an admin and also reflect each machine shown at the bottom.
Everything is being populated from a database and I already have the layout done I just need a good recommendation for a table structure.