I noticed that WordPress (PHP software) can insert arrays into the database and retrieve it. How can I do the same? Do I have to pass the array through a function.
@NogDogMar 28.2011 — #serialize() the array before inserting it into the DB, then unserialize() it when you retrieve it.
PS: Don't forget to use the proper escaping mechanism for the DBMS extension being used (e.g. mysql_real_escape_string() for MySQL) [i]after[/i] serializing it before you then insert it. [code=php] $string_to_insert = mysql_real_escape_string(serialize($my_array)); $sql = "INSERT INTO table (the_data) VALUES ('$string_to_insert')"; [/code]