Connecting Tech Pros Worldwide Forums | Help | Site Map

Multiple input field data in one mysql table column

Newbie
 
Join Date: May 2007
Posts: 4
#1: Jun 3 '07
Hi,

Can anyone help me!

I have multiple auto generated input fields(e.g. values are 1 to 10) in a form and I want to insert all input fields data in one column of MySQL table. Is there any way to insert these data? Please help me.

Thanks for your help in advance.

Best,

DJ

pbmods's Avatar
Site Moderator
 
Join Date: Apr 2007
Location: Texas
Posts: 5,435
#2: Jun 4 '07

re: Multiple input field data in one mysql table column


You can concatenate the values using e.g., a comma and then split the string when you retrieve the data. You could also save a serialized or JSON-encoded array.

There is, however, no support in MySQL for saving multiple values to one field in a row.
bartonc's Avatar
Moderator
 
Join Date: Sep 2006
Location: Minden, Nevada, USA
Posts: 6,400
#3: Jun 4 '07

re: Multiple input field data in one mysql table column


Quote:

Originally Posted by djdarpan

Hi,

Can anyone help me!

I have multiple auto generated input fields(e.g. values are 1 to 10) in a form and I want to insert all input fields data in one column of MySQL table. Is there any way to insert these data? Please help me.

Thanks for your help in advance.

Best,

DJ

As my friend, pbmods, points out; "There is, however, no support in MySQL for saving multiple values to one field in a row.". There is a very good reason for this. The first rule of normalization (1NF) states that data must be atomic (consisting of only one value).
Reply