0

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:

  1. Use separate meta table for every input type (20+)
  2. 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.

  • 1
    I don't understand how your front-end design should affect your back-end? Can you explain how the two are connected? – Colin 't Hart May 28 '14 at 13:16
  • Users in application are generating custom forms. – sonia May 28 '14 at 13:22
2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.