I am wondering if there is any way while executing a query in MySQL to find out which portion of the WHERE clause caused the query to fail. For example, I have the following SQL statement in my script to aid in the logging in of a user.
$SQL = "SELECT ID, userLevel, DATE_FORMAT(userLastLogin, '%a %b %e %Y')
FROM $this->dbUsers
WHERE LOWER(userID) LIKE LOWER('$userID')
AND LOWER(userPass) LIKE LOWER(PASSWORD('$userPassword'))
AND userEnabled='True'";
If the query returns 0 results, I would like to know which part was the reason. Was it that there was no userID that matches $userID? Was it because the password was incorrect? Was it because the value for userEnabled was set to False instead of true?
I can think of how to do this via 3 separate queries, but I'd like to keep it as one.
Any suggestions (if this makes sense)?