MySQL 错误:错误使用 UPDATE 和 LIMIT
如何纠正这个问题,以便我的 MySQL 代码正常工作.
How can I correct this problem so that my MySQL code works correctly.
这是我的 MySQL 代码,它给我带来了问题.
Here is my MySQL code that gives me the problem.
$q = "UPDATE users INNER JOIN contact_info ON contact_info.user_id = users.user_id SET active.users = NULL WHERE (email.contact_info = '" . mysqli_real_escape_string($mysqli, $x) . "' AND active.users = '" . mysqli_real_escape_string($mysqli, $y) . "') LIMIT 1";
$r = mysqli_query ($mysqli, $q) or trigger_error("Query: $q
<br />MySQL Error: " . mysqli_error($mysqli));
推荐答案
根据 MySQL docs for 更新:
As per the MySQL docs for UPDATE:
对于多表语法,UPDATE 更新 table_references 中命名的每个表中满足条件的行.在这种情况下,不能使用 ORDER BY 和 LIMIT.
For the multiple-table syntax, UPDATE updates rows in each table named in table_references that satisfy the conditions. In this case, ORDER BY and LIMIT cannot be used.
相关文章