我收到PDO错误信息42000
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 'WHERE id='4'' at line 15
我不知道为什么,当我读到有关此问题的其他问题时,我尝试用反引号转义列和表名,但这没有帮助。
这是我的SQL语句:
private function _update()
{
$sql = 'UPDATE projects SET
name=:name,
client=:client,
createDate=:createDate,
timestamp=:timestamp,
url=:url,
localUrl=:localUrl,
budget=:budget,
payoff=:payoff,
estimated_time=:estimated_time,
tasksDuration=:tasksDuration,
currentStundenlohn=:currentStundenlohn,
tagPercentage=:tagPercentage,
tagCategoryPercentage=:tagCategoryPercentage,
WHERE id=:id';
$abfrage = self::$db->prepare($sql);
$abfrage->execute($this->toArray());
pdo_error($abfrage);
}
你看到可能出现的问题吗?
答案 0 :(得分:1)
删除最后一个额外的逗号,
。
$sql = 'UPDATE projects SET
name=:name,
client=:client,
createDate=:createDate,
timestamp=:timestamp,
url=:url,
localUrl=:localUrl,
budget=:budget,
payoff=:payoff,
estimated_time=:estimated_time,
tasksDuration=:tasksDuration,
currentStundenlohn=:currentStundenlohn,
tagPercentage=:tagPercentage,
tagCategoryPercentage=:tagCategoryPercentage // From here
WHERE id=:id';