<分区>
PHP 代码使用带有准备好的语句的 PDO 查询来更新我的表的部分。
收到的错误是:
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 'WHERE `EditID` = 13' at line 3
)
但是,我不确定语法错误的性质是什么。
这是我的 PHP 代码:
<?php
$pdo=new PDO("mysql:dbname=createyo_TestDatabase;host=localhost","createyo_james","password");
$statement=$pdo->prepare("UPDATE `Edits` SET `Rep` = :Reputation, WHERE `EditID` = :EditID");
$statement->bindValue(':Reputation', (int) trim($_GET['Reputation']), PDO::PARAM_INT);
$statement->bindValue(':EditID', (int) trim($_GET['EditID']), PDO::PARAM_INT);
$statement->execute() or die(print_r($statement->errorInfo()));
$results=$statement->fetchAll(PDO::FETCH_ASSOC);
$json=json_encode($results);
print $json;
?>