So I have a custom PHP object which I have serialized and I am trying to insert it into a MySQL database with PHP Code:
$serializedOrder = serialize($objectOrder);
//I have tried both of these, and all combinations of them
$serializedOrder = mysql_real_escape_string($serializedOrder);
$serializedOrder = stripslashes($serializedOrder);
$result = mysql_query("INSERT INTO orders(order) VALUES('".$serializedOrder."')");
if ($result == false) {
echo "mysql_query failed ";
echo mysql_error();
echo " ";
echo mysql_errno();
}
This produces the reponse:
mysql_query failed You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order) VALUES('O:10:"OrderClass":6:{s:9:"foodArray";a:0:{}s:8:"baseTime";i:0;s:1' at line 1 1064
The total serialized string is:
O:10:"OrderClass":6:{s:9:"foodArray";a:0:{}s:8:"baseTime";i:0;s:11:"orderNumber";i:0;s:11:"truckNumber";i:0;s:10:"customerID";i:0;s:11:"orderStatus";s:0:"";}
Any help is appreciated.