Although I’m sure many people already knew the answer to this, I wanted to post the solution mainly so that I don’t forget. I spent about 30 mins looking for the answer again yesterday since I had forgotten it from the last time I used it.
To store an array (even a multi-dimensional array) from PHP into MySQL, use the serialize() and unserialize() functions. There’s other ways of doing it I’m sure, but this has proven quick and painless for myself. So, sample code might be:
//To insert
$SampleArray = array();
$SampleArray = serialize($SampleArray);$sql = “INSERT INTO table (‘ArrayField’) VALUES (‘$SampleArray’);
//Run sql statement//To retrieve
$SampleArray = unserialize($row_table['ArrayField']);





