Reputation: 53
I am quite a NOOB at SQL. I have a table with a bunch of columns listed member1 - member40. I want my PHP file to check and see if a username is found in one of the 40 member columns.
I was going to try something like this:
SELECT * from members WHERE member1 OR member2 OR member3 [...] OR member40 = '". $username ."'
Can you even do it like I did it above?
Is there a more efficient way to check every column in every row to see if any data matches?
(After...)I would then print the id's of all the rows that matched on my PHP file so that the user would know how many groups he was a member of.
Upvotes: 0
Views: 37
Reputation:
The correct synatx would be ...WHERE member1="Joe" OR member2="Joe"
Upvotes: 1