我试图更新我表中的记录但是我收到以下错误...
SQLSTATE[42000]: Syntax error or access violation: 1064 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 '(`First_Name`,`Surname`,`Nicknames`' at line 1Number of rows added: Go back
我的代码如下......
// Connection data (server_address, database, name, poassword)
$hostdb = 'localhost';
$namedb = '_co_';
$userdb = '';
$passdb = '';
try {
// Connect and create the PDO object
$conn = new PDO("mysql:host=$hostdb; dbname=$namedb", $userdb, $passdb);
$conn->exec("SET CHARACTER SET utf8"); // Sets encoding UTF-8
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "UPDATE `directory` (`First_Name`,`Surname`,`Nicknames`)
VALUES (:firstname, :surname, :nicknames)
WHERE ID = :cid
;
";
$statement = $conn->prepare($sql);
$statement->bindValue(":cid", $cid);
$statement->bindValue(":firstname", $firstname);
$statement->bindValue(":surname", $surname);
$statement->bindValue(":nicknames", $nicknames);