I’ve got two tables in my db. One called forms and one called form_fields. form_fields will contain a list of fields that any form may have… first_name, last_name, email, address, hieght, weight, etc… forms will be a list of unique forms that may or may not contain any number of those fields in form_fields.
So, my question is, what is the standard practice for using the data in form_fields to relate to forms?
Should I
a) Create a column in forms called field_array and create an array of indexes that relate to the index numbers (primary key) of each field in form_fields?
or
b) Create a relation table and insert rows of two columns for every form field chosen. One column being the form unique index and the other being the chosen form field unique index?
I feel like having a field in forms filled up with comma delimited numbers is a little weird. I’ve been at this a few years now, independently, so I’m not always positive if there is a tried and true method for these types of cross table associations.
Thanks in advance.
You should go with the association or relation or junction table approach.
Your new table might be: