Ryza Ryza - 6 months ago 67
MySQL Question

select * from table where column = value ^ column2= value

I am creating a login system in PHP. I need a user to use either his or her username or email or phone number to login then the password. since I know in java we would do like

email==user^ username == user
does this apply in MySQL. Could I do something like this in MySQL?

Select * from user WHERE mail = 'user' ^ phoneNo= 'user' ^ username = 'user' and password = 'pass'

I have tried it and it failed. Alternatively, I use multiple
s in PHP and check one at a time like this

if (mail == user){


The query would be -

Select * from user WHERE (mail = 'user' or phoneNo= 'user' or username = 'user') and password = 'pass'


Select * from user WHERE 'user' in (mail, phoneNo, username) and password = 'pass'