I have a table named "users" in MySQL with these data(data types):
id(10 digit INT), email(char-32), phone(13 digit INT), password(char-64)
I need to build a login page that accepts id/email/phone as username. Then it should search the table for any match and then check the password.
My query for getting data is this:
SELECT id, email, phone, password FROM users WHERE username IN (id, email, phone);
The problem is that when I try to search for email, it returns correct AND NULL records.
What am I doing wrong?
Sorry for my poor English.
edit:
I can check for username type in php then execute a type-specific query. But is there a way to use a single query to do it?
VARCHAR(255)as a default "string" value and don't trim that or extended it unless you have a compelling reason to do so.