gpt4 book ai didi

php - 这个查询有什么问题

转载 作者:行者123 更新时间:2023-11-29 14:12:19 25 4
gpt4 key购买 nike

$deleteUser = $_POST['userId'];

$query = "DELETE FROM users AS USERS
LEFT JOIN posts AS POSTS
ON USERS.id = POSTS.postAuthor
WHERE USERS.id = '$deleteUser' AND POSTS.postAuthor = '$deleteUser'";

我正在尝试删除该用户以及他们可能创建的任何帖子。我错过了什么?

最佳答案

指定执行DELETE的表或别名

DELETE USERS FROM users AS USERS
LEFT JOIN posts AS POSTS
ON USERS.id = POSTS.postAuthor
WHERE USERS.id = '$deleteUser' AND POSTS.postAuthor = '$deleteUser'

关于php - 这个查询有什么问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13283013/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com