MySQL 错误:UPDATE 和 LIMIT 的错误使用

2021-11-20 00:00:00 sql-update mysql

如何更正此问题,以便我的 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\n<br />MySQL Error: " . mysqli_error($mysqli));

推荐答案

根据 更新:

对于多表语法,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.

相关文章