Link to home
Start Free TrialLog in
Avatar of Johnny
JohnnyFlag for United States of America

asked on

mysql search like and city/state

i have a need to search for food and define a city and state in a sql statement and mines not working right

i need to search fields for food(if its there) and only the city state.

heres my code sql statement and its returning all cities and states as i think if it find food it does not care i only want ones in springfield oh. i need to limit it to the city/state
how do i do that please

sql: SELECT * FROM iwia_events WHERE event_title LIKE '%food%' OR event_location LIKE '%food%' OR event_text LIKE '%food%' OR extra_info LIKE '%food%' OR categories LIKE '%food%' OR type LIKE '%food%' AND event_location LIKE '%Springfield%' AND event_location LIKE'%OH%' LIMIT 0,5 

Open in new window


id say a better way to ask this is how do i search in the above fields for any words if there present anywhere in the field record and only return records that match city and state defined

thank you in advance for any code or help you may provide
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Johnny

ASKER

thank you so much