1

我正在尝试运行以下查询:

$sth = "UPDATE `users` SET users_password VALUES (:hash) WHERE users_id = $users_id";
$q = $conn->prepare($sth);
$q->execute(array(':hash'=>$hash));

但我得到以下信息:

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 MySQL server version for the right syntax to use near 'VALUES ('$2y$12$Ao46iC7W9Lj8FFfSmAaeoeQs9O.3QRVtDbHAyvpzH90YIUN61ma8i') WHERE us' at line 1'

有任何想法吗?

(是的,代码不在 try, catch 块中,但只是在此时尝试一些东西)

4

1 回答 1

0

改变这个

$sth = "UPDATE `users` SET users_password VALUES (:hash) WHERE users_id = $users_id";

$sth = "UPDATE `users` SET users_password = :hash WHERE users_id = $users_id";
于 2013-04-17T12:32:05.683 回答