How to store a string array into MySQL
Moderator: General Moderators
-
Mythic Fr0st
- Forum Contributor
- Posts: 137
- Joined: Sat Dec 02, 2006 3:23 am
- Contact:
How to store a string array into MySQL
How do I store a string array into MySQL
even better yet, how do I create a "string" array in PhpMyAdmin (for MySQL) or using SQL
even better yet, how do I create a "string" array in PhpMyAdmin (for MySQL) or using SQL
Has its good side. It's vague enough to point to http://dev.mysql.com/tech-resources/art ... ation.htmlfeyd wrote:Hmm, vague description.
Code: Select all
$array = implode( $_POST['array']);
$query = "INSERT INTO table (field) VALUES ('$array')";
mysql_query($query) or die (mysql_error());-Pete
Last edited by psurrena on Thu Dec 14, 2006 8:30 pm, edited 1 time in total.
-
Mythic Fr0st
- Forum Contributor
- Posts: 137
- Joined: Sat Dec 02, 2006 3:23 am
- Contact:
ok
Thanks, but how would I create it like...
etc...? would that work, I need to store 2 values in it first -.-
Code: Select all
$array = implode("array0","array1")
$query = "INSERT INTO field (text) VALUES ('$array')";
mysql_query($query) or die (mysql_error());etc...? would that work, I need to store 2 values in it first -.-
Last edited by Mythic Fr0st on Thu Dec 14, 2006 5:17 pm, edited 1 time in total.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Re: ok
What have you tried so far?Mythic Fr0st wrote:Thanks, but how would I create it like...
Code: Select all
$array = implode("array0","array1") $query = "INSERT INTO field (text) VALUES ('$array')"; mysql_query($query) or die (mysql_error());
etc...? would that work, I need to store 2 values in it first -.-
-
Mythic Fr0st
- Forum Contributor
- Posts: 137
- Joined: Sat Dec 02, 2006 3:23 am
- Contact:
nvm
Nevermind, thanks guys, got a friend on trillion to help me with it
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
-
Mythic Fr0st
- Forum Contributor
- Posts: 137
- Joined: Sat Dec 02, 2006 3:23 am
- Contact:
Yep
Yep, and what I did didnt work:P
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
fyi, you might want to read the manual on what arguments implode is supposed to take
Code: Select all
implode()- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
Code: Select all
serialize()Code: Select all
unserialize()Cheers,
Kieran