尝试更新数据库中的表时出现此错误。
代码:
$stmt = $db->query("UPDATE pages SET title, desc VALUES :title, :newdesc WHERE id = '1'");
$stmt = $db->execute(array(":title" => "Awesome", ":newdesc" => "TEST"));
我得到的错误就是这个,我发现它与我的代码的其他部分无关,因为我把它放到一个空文件中并且发生了同样的事情:
错误:
[23-Aug-2016 15:24:02 America/Chicago] PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' desc VALUES :title, :newdesc WHERE id = '1'' at line 1' in /home/officia4/GPTScript/mitch.php:25
Stack trace:
#0 /home/officia4/GPTScript/mitch.php(25): PDO->query('UPDATE pages SE...')
#1 {main}
thrown in /home/officia4/GPTScript/mitch.php on line 25