Here’s my array:
array(2) {
[0]=>
string(4) "0002"
[1]=>
string(4) "0001"
}
It’s passed form javascript to my php to save in a database.
Before saving to the database I:
$myArray = serialize($post['myArray']);
But in my database (mysql) I get this:
a:2:{i:0;s:4:"0002";i:1;s:4:"0001";}
Any ideas whats going wrong?
Also a var dump before database submission gives:
string(36) "a:2:{i:0;s:4:"0002";i:1;s:4:"0001";}"
You serializing an array which result as formated string. When You retrive your data back from DB, You have to convert this string back into array using unserialize function.
http://cz.php.net/manual/en/function.unserialize.php