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:
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%')
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?
Use a GROUP BY `id` clause (or some other field that uniquely identifies each row).
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.