I have a problem. I can't save my array data to database, i don't know why. I try some version:
ver1:
$data=$_SESSION['need_save_data'];
$sql = "INSERT INTO session_search_data (`user_id`,`data`,`date`) VALUES ('" . $_SESSION['web_page_user_data']['id'] . "'," . $db_handler->db->quote(json_encode($data)) . ",'" . time() . "')";
$db_handler->db->query($sql);
and it save the database: [] if i echo my query, and run it in mysql console, it working fine:
INSERT INTO session_search_data (`user_id`,`data`,`date`) VALUES ('8','{\"selected_manufacturer_id\":\"504\"}','1442571431')
I try save the database json_encode, the result is similar, it save empty variable.
Also i try to save to file:
$data=$_SESSION['need_save_data'];
$filename = 'session_data/' . $_SESSION['web_page_user_data']['id'] . '.php';
$file = fopen($filename, "w");
fwrite($file, serialize($data));
I try save with json_encode, var_export, serialize, the result is: save empty variable data.
I use PHP 5.4 last version, i think it is configuration problem, because my code works fine two other servers, and my localhost.
data
table.$db_handler->db->query($sql);
Do that and it will tell you what is wrongserialize
orjson_encode
and array of ONE ITEM?? What is the point??