For a web application I need to make some kind of checklist for users. The checklist is administrated by a special administrator account and only he can edit the checklist. Each user has it’s own checklist with certain conditions which has to be checked when that condition is met. Also I added a textbox for any comments (if there are any)
I constructed a few tables in a MySQL database:
A users database which has the data of all registered users
A table called checklist properties with the following columns:
property_idnr | type | description
Next a table which links the user with the property with the following columns:
link_idnr | user_idnr | property_idnr | comments
Now my question is, did I set this up properly? Also, I am having a bit of an issue with the Query’s.. what is the best way to store these values in the database?
I hope someone is able to help me out with this, if you need any more information, please ask!
Your schema looks reasonable. To get the list for a given user, you would use a query like this:
What I would suggest adding is an ordering column into the CheckListLink table. Different users may have their check list ordered in different ways. Also, I would add a datetime column to all the tables, so you know when the records were created.
Storing the values . . . Well, you need a way to set up the possible items in the check list. And, then you need a way for users to choose the items they want in their check list. From a database perspective, this is just a question of various insert statements (perhaps deletes as well). The bigger challenge is on the UI side.