语法错误或访问冲突:1064 您的 SQL 语法有误;
Syntax error or access violation: 1064 You have an error in your SQL syntax;
我在使用以下代码时遇到了一些奇怪的错误:
date_default_timezone_set('Europe/London');
$date = date("Y-m-d H:i:s");
$stmt = $this->registry->db->getDB()->prepare("INSERT INTO `comments` (date_posted,comment) VALUES ?,?");
$stmt->execute(array($date,$comment));
check the manual that corresponds to your MySQL server version for the
right syntax to use near ''2015-04-27 15:26:31','Very good'' at line 1
in C:\wamp\www\model\qualityControlModel.class.php on line 161
有人知道为什么会这样吗?
查询行的正确语法包括所有括号,包括 VALUES
:
周围的括号
$stmt = $this->registry->db->getDB()->prepare("INSERT INTO `comments` (date_posted,comment) VALUES (?,?)");
我在使用以下代码时遇到了一些奇怪的错误:
date_default_timezone_set('Europe/London');
$date = date("Y-m-d H:i:s");
$stmt = $this->registry->db->getDB()->prepare("INSERT INTO `comments` (date_posted,comment) VALUES ?,?");
$stmt->execute(array($date,$comment));
check the manual that corresponds to your MySQL server version for the right syntax to use near ''2015-04-27 15:26:31','Very good'' at line 1 in C:\wamp\www\model\qualityControlModel.class.php on line 161
有人知道为什么会这样吗?
查询行的正确语法包括所有括号,包括 VALUES
:
$stmt = $this->registry->db->getDB()->prepare("INSERT INTO `comments` (date_posted,comment) VALUES (?,?)");