|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
mysql: an array as a field of a table....
Hi!
I work with mysql and php. I need to create a table with an array field. Is it possible? |
|
#2
|
|||
|
|||
|
you mean you want to store data from an array into the database?
PHP Code:
|
|
#3
|
|||
|
|||
|
Thanks Ben...
What I wanted to know: is it possible to define a field of a table as an array. I have a form (username,password,name,age,city,country....and interests) interests is a series of checkboxes (music, tv, sport...). The user can check one or more choices. Then, I have a table in which I store the data of the form. create table user(username varchar(10), password varchar(10), name varchar(50), . . . interests varchar(20)); is it possible to define the field interests as an array?(I'm using Mysql). |
|
#4
|
|||
|
|||
|
Not in MySQL, what i would do is use my example that i gave you, or do something like this
<?php $array = array('lastname', 'email', 'phone'); $comma_separated = implode(",", $array); print $comma_separated; // lastname,email,phone ?> then store $comma_separated in the database when you pull it back out, explode it, and then you will have your array! |
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > mysql: an array as a field of a table.... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|