Search Form
Posted: Fri Aug 10, 2007 6:46 am
Hey people,
I'm trying to generate a search form that allows a user to search many fields (at mysql database) at the same time. my original thought was to use a SELECT statement that will use a WHERE clause containing several OR clauses. Example:
The problem is that i am getting many duplicated results (meaning results that are referring to the same row at the database). Can you recommend another approach for achieving what i am trying to achieve. Is it better to use several mysql statement in my PHP code or any other way?
Appreciate your comments.
Thanks ahead,
I'm trying to generate a search form that allows a user to search many fields (at mysql database) at the same time. my original thought was to use a SELECT statement that will use a WHERE clause containing several OR clauses. Example:
Code: Select all
SELECT count(*) as total FROM teachings WHERE (title LIKE '%a%' OR teacher LIKE '%a%' OR institution LIKE '%a%' OR countries LIKE '%a%' OR disciplines LIKE '%a%')Appreciate your comments.
Thanks ahead,