Hello! I have a login code, but I can not get the user to log in with your email or username using the same field! Below is my code, the email on my base date is named "mail".
Hello! I have a login code, but I can not get the user to log in with your email or username using the same field! Below is my code, the email on my base date is named "mail".
In order to be able to log in with username and email at the same time, you must add query an OR. Example
SELECT username, password FROM users
WHERE (username = "usernameRecebido" OR email = "emailRecebido")
AND password = "passwordRecebido"
If I understood your question and your code, you just put a OR
:
$userq = mysql_query("SELECT username, password FROM users WHERE (username = '{HoloText($_POST['credentials_username'])}' OR mail='$email') AND password = '$pwd' LIMIT 1");
Tip: Sometimes using javascript to do a field validation gets better and simpler.