Avatar of Luey
Luey
Flag for United States of America asked on

select from more than one column mysql

Is it possible to select from more than one column in sql.
What i am trying to do is build a search where if I type a first name or a last name in my search form I can retrieve data checking two different columns.  Is that possible.  This code does not work but it may give you an idea of what I am trying to do.  I want to look in mem_first_name or mem_last_name and retrieve all that match my search.

"SELECT * FROM members WHERE mem_first_name = %s OR mem_last_name = %s"

Open in new window

MySQL ServerPHP

Avatar of undefined
Last Comment
Luey

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Guy Hengel [angelIII / a3]

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Luey

ASKER
I thought it would to.  I did it a different way and it worked as well.
Thanks for you help.
"SELECT * FROM members WHERE mem_first_name = '$search_name' OR mem_last_name = '$search_name'";
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck