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.

asked May 28, 2014 at 12:48
2
  • 1
    I don't understand how your front-end design should affect your back-end? Can you explain how the two are connected? Commented May 28, 2014 at 13:16
  • Users in application are generating custom forms. Commented May 28, 2014 at 13:22

1 Answer 1

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.

answered May 28, 2014 at 13:56
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.