I'm making form-generating app in php. I have Widget table with type_id (html input) field, and I would like to add options field, like width/height, step, range, etc. Different widgets do have different options though.
I can think of two options:
- Use separate meta table for every input type (20+)
- Use serialized array as a meta
Option 1 seem more "legal", but option 2 would be easier to implement and maintain(?).
Would performance be considerably better with option 1?
EDIT: This widget table will be accessed only through widget_id and used to render html. Changes are possible, but they shouldn't happen that often.
-
1I don't understand how your front-end design should affect your back-end? Can you explain how the two are connected?Colin 't Hart– Colin 't Hart2014年05月28日 13:16:10 +00:00Commented May 28, 2014 at 13:16
-
Users in application are generating custom forms.sonia– sonia2014年05月28日 13:22:22 +00:00Commented May 28, 2014 at 13:22
1 Answer 1
If you actually plan to query these attributes separately (such as "Find all form elements with height = 20 and colour = #FF3377") then it is probably better to store them in some kind of queryable attributes table. If you are only plan to use a set of attributes as a whole, and never query inside it, never update/insert/delete individual attributes for specific form elements, then serializing the array and storing it as a BLOB (or something) might not be so bad, as it would keep your design simpler.
Explore related questions
See similar questions with these tags.