0

I need to store the value of about 20 different fields into MySQL. They needs different supported length. Some of them are numbers, some of them have only one character as their value, and some others may need a space as big as text data type in MySQL.
I have 2 choises:
1- Storing all of these values as an array into one record of tables using PHP Serilalize() function (Save PHP array to MySQL?). In this case I need only one field with text data type. 2- Storing these values in a new table inside relational database. But in this case I need different rows that I am not sure about the value that must be stored in them. So I must assign text data type for all of them to support maximum values.

I'm sorry if I could not say my mean completely.
What is your suggestion for this case ?

Community
  • 1
  • 1
Mohammad Saberi
  • 12,864
  • 27
  • 75
  • 127
  • borderline opinion related... would argue that it depends if you need to (or there is value in) referencing data within the array directly from the db or not. If you are just dumping trash with a unique id, then your first option works I guess. What is the usage of this data? – Dave Jun 16 '14 at 17:46
  • I need to let user to choose some defined fields to fill by others, and then people fill these different fields. Finally, I must show selected fields and their answers – Mohammad Saberi Jun 16 '14 at 17:48
  • Are all possible fields known ahead of time (i.e. is there a set schema for the table)? Otherwise you may want to use some other document storage database if possible. – Explosion Pills Jun 16 '14 at 17:49
  • @ExplosionPills, there are about 20 questions that owner select some of them. Then others will answer them. Some of these fields are in shape of radion buttons, some of them are text box, and others are textarea. – Mohammad Saberi Jun 16 '14 at 17:51
  • If you can provide a couple of examples to show the differences or similarities in what you are trying to accomplish that may help, but I tend to agree with @Explosion, sounds like you are drifting into wordpress like territory – Dave Jun 16 '14 at 17:52

0 Answers0