Php 在Mysql中节省时间()
我使用以下代码来节省时间。我已尝试将列类型更新为DATETIME和TIMESTAMPPhp 在Mysql中节省时间(),php,mysql,pdo,Php,Mysql,Pdo,我使用以下代码来节省时间。我已尝试将列类型更新为DATETIME和TIMESTAMP $statement = $conn->prepare('UPDATE users SET update = :update WHERE id = :clientId'); $statement->bindParam(':clientId', $clientId, PDO::PARAM_STR); $statement->bind
$statement = $conn->prepare('UPDATE users SET update = :update WHERE id = :clientId');
$statement->bindParam(':clientId', $clientId, PDO::PARAM_STR);
$statement->bindParam(':update', time(), PDO::PARAM_STR);
$statement->execute();
{"error":"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 'update = '1367692928' WHERE id = 'I9pm90r-b4'' at line 1"}
update
是一个保留关键字,恰好是列的名称。为了避免语法错误,应该使用反勾号转义列名。前,
UPDATE users SET `update` = :update WHERE id = :clientId