MySQL Forums
Forum List  »  PHP

multiple "search" conditions
Posted by: latesh chawla
Date: February 18, 2009 08:02AM

hey there,

here's my problem:-
i have a search form..with many text fields like 'firstname', 'last name', 'city', 'state', 'country', 'location'...etc etc
now the thing is user can enter any combination in this form...
for ex: if he enters firstname to search as 'David' and lastname as 'kingston' and country as 'india'...
or he can only enter 'firstname' and 'lastname' for search........
so only these fields should be considered for search and exact same data should be retrieved from the database....
now i cant use 'AND' query with all fields since i wudnt knw which combination search would be used...nor I can use 'OR' since that wud pick up any 1 field which will return many rows resulting some duplicated or unwanted data....

I hope some one help me here with some logic...using PHP/MYSQL

Thanks in Advance...

Latesh Chawla

Options: ReplyQuote


Subject
Written By
Posted
multiple "search" conditions
February 18, 2009 08:02AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.