Does PHP automatically know how to store arrays in MySQL? If so, what data type should I use for the field the array will be inserted into?
Use the PHP Implode() function to transform the array into a delimited string taht you can insert into a field in the db. Then use the explode() function to change it back into an array later.
Hi,
Another option besides using implode() and explode() is to use serialize() and unserialize().
Greetz,
Jurriaan
Quite right Jurriaan, I forgot that one. ;-)
What column type should I use for the table field that will hold the array? Also, will these functions work for multidimensional arrays?
From the manual:
Serialize() returns a string containing a byte-stream representation of value that can be stored anywhere.
So, a columnd type of varchar or text sounds about right.