Page 1 of 1

How to store a string array into MySQL

Posted: Wed Dec 13, 2006 9:35 pm
by Mythic Fr0st
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

Posted: Wed Dec 13, 2006 9:41 pm
by feyd
Hmm, vague description.

Separate records.

Posted: Thu Dec 14, 2006 3:20 am
by volka
feyd wrote:Hmm, vague description.
Has its good side. It's vague enough to point to http://dev.mysql.com/tech-resources/art ... ation.html ;)

Posted: Thu Dec 14, 2006 2:14 pm
by psurrena

Code: Select all

$array =  implode( $_POST['array']);
$query = "INSERT INTO table (field) VALUES ('$array')";
mysql_query($query) or die (mysql_error());
implode() did it for me. Otherwise it would just insert the word "array".

-Pete

ok

Posted: Thu Dec 14, 2006 5:07 pm
by Mythic Fr0st
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 -.-

Posted: Thu Dec 14, 2006 5:10 pm
by psurrena
For me, it was creating an array from check boxes.

Check out the thread:
viewtopic.php?t=60771

Posted: Thu Dec 14, 2006 5:24 pm
by Luke
buddy... that link points to this thread. :lol:

Posted: Thu Dec 14, 2006 5:28 pm
by psurrena
buddy? haha ok...chief

viewtopic.php?t=60450

later pal

Re: ok

Posted: Thu Dec 14, 2006 5:52 pm
by RobertGonzalez
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 -.-
What have you tried so far?

nvm

Posted: Thu Dec 14, 2006 6:13 pm
by Mythic Fr0st
Nevermind, thanks guys, got a friend on trillion to help me with it

Posted: Thu Dec 14, 2006 6:32 pm
by RobertGonzalez
Did you ever try anything on this?

Yep

Posted: Thu Dec 14, 2006 7:16 pm
by Mythic Fr0st
Yep, and what I did didnt work:P

Posted: Thu Dec 14, 2006 7:19 pm
by John Cartwright
fyi, you might want to read the manual on what arguments implode is supposed to take

Code: Select all

implode()

Posted: Thu Dec 14, 2006 9:18 pm
by Kieran Huggins

Code: Select all

serialize()
and

Code: Select all

unserialize()
are what you're looking for, I think.

Cheers,
Kieran