I’m using CI’s active record to generation a query result. This is the meat of the query produced:
WHERE manufacturers.name = 'Ford'
OR dealer_email LIKE '%Ford%'
OR dealer_name LIKE '%Ford%'
OR dealer_contact = 'Ford'
OR dealer_city = 'Ford'
OR regions.name = 'Ford'
OR states.state_name = 'Ford'
AND `dealer_city` IN ('Atlanta')
I want just the Ford dealers in Atlanta. The result returns all Ford dealers and all dealers in Atlanta. I don’t understand where my logic is wrong. PS: The extra OR statements are part of a broad search for “Ford”, because it could also be name or contact IN Atlanta and it’s typed into a search box.
Like this?