I am trying to insert a serialize data into mySQL using PDO and I'm hitting some syntax error. Have I missed out something?
Some simplified coding:
$test['1'] = "one";
$condition = serialize($test);
$stmt = $dbh->prepare("INSERT INTO weather(condition) VALUES (:condition)");
$stmt->bindParam(":condition",$condition);
$stmt->execute();
$stmt->debugDumpParams()
shows
SQL: [67] INSERT INTO weather(condition)
VALUES (:condition) Params: 1 Key: Name: [10] :condition paramno=-1 name=[10] ":condition" is_param=1 param_type=2
print_r($stmt->errorInfo())
shows
Array ( [0] => 42000 [1] => 1064 [2] => 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 'condition) VALUES ('a:1:{i:1;s:3:\"one\";}')' at line 1 )