编码时我的眼睛真的很模糊,似乎无法找出导致HY093
我使用 PDO 将数据插入 mysql 的错误的原因
function whatever($post_id, $comment) {
...
$query = "INSERT INTO `comments` (`id`, `post_id`, `comment`) VALUES (:id, post_id,:comment)";
$sql = $db->prepare($query);
$check = $sql->execute(array(':id'=>'',
':post_id'=>$post_id,
':comment'=>$comment));
//verify if data is inserted
if($check) {
$test = 'inserted';
} else {
$test = $sql->errorCode();
}
return $test;
}
我得到这个错误HY093
。
myid
是自动递增的,我不确定 using''
是否是正确的声明方式。