$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'";
I'm trying to remove the user and any posts they may have created. what am i missing?
specify the table or the alias where the DELETE
exucutes
DELETE USERS FROM users AS USERS
LEFT JOIN posts AS POSTS
ON USERS.id = POSTS.postAuthor
WHERE USERS.id = '$deleteUser' AND POSTS.postAuthor = '$deleteUser'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.