i’ve known this for a while but forgot to share it. there is a very easy way you can store array into database as a string. then you can grab the string from the database and convert it back into an array.
<?php $myarray = "meow"; $myarray = "woof"; $myarray[meow] = "cool"; $myarray[woof] = "cool"; $myarray[thisrules] = "Mmmm"; $text_myarray = serialize($myarray); // store it into my database (depend on the length of your array, declare the column as text or varchar) // pull it out of my database, suppose $out_of_my_database stores the text from your database column // then $get_myarray = unserialize($out_of_my_database); echo "<pre>"; print_r($get_myarray); ?>
you should get
Array (  => meow  => woof [meow] => cool [woof] => cool [thisrules] => Array (  => Mmmm ) )