我在 $username 和 $email 被替换的 PHP 变量中编写此代码。我在屏幕上回显了它,它看起来是正确的。我假设 MySQL 代码存在问题,因为我总是得到的唯一结果是“可接受的”。有什么帮助吗?
SELECT CASE
WHEN email='$email' THEN '$email is already associated with an account'
WHEN username='$username' THEN '$username is already taken'
ELSE 'acceptable'
END AS result FROM collaborator
UNION
SELECT CASE
WHEN email='$email' THEN '$email is already associated with an account'
WHEN username='$username' THEN '$username is already taken'
ELSE 'acceptable'
END AS result
FROM waitForValidation
LIMIT 1;