I’m storing some information which has been serialized by using jQuery into a MySQL database :
$(function () {
$("#sortable").sortable({
stop: function (event, ui) {
$("#q35list").val($(this).sortable('serialize'));
}
});
$("#sortable").disableSelection();
This stores the relevant information in the DB fine (via a .php save page).
However, when I return it and unserialize it using the following:
$arr = unserialize($results['q35list']);
if(!$arr) $arr=array();
var_dump($arr);
It’ not an array! It’s as follows:
string(55) "Set[]=2&Set[]=1&Set[]=3&Set[]=4&Set[]=5&Set[]=6&Set[]=7"
I am now at the point where I cannot see the wood from the trees…
jQuery serialization and PHP serialization are two separate things. jQuery focuses on being able to send the data through CGI (either GET or POST), PHP serialization focuses on storing structured data in a string.
They are not interchangeable.
You have to serialize and unserialize in the same platform, or it will not work.