[eluser]Unknown[/eluser]
Have a weird problem that I may just be over thinking.
I have a simple SQL statement, but for some reason... it ignores the the where clauses and just performs the LIKE portion when the query is ran like this:
SELECT *
FROM (`homes`)
WHERE `assigned_to` = '2451'
AND `status` = '4'
AND `id` LIKE '%gary%'
OR `first_name` LIKE '%gary%'
OR `last_name` LIKE '%gary%'
OR `email_address` LIKE '%gary%'
OR `company` LIKE '%gary%'
OR `address` LIKE '%gary%'
OR `note_promotion` LIKE '%gary%'
OR `note_experience` LIKE '%gary%'
ORDER BY `id` DESC
LIMIT 25
So, it runs all homes, all assignments etc and just works the LIKE portion.
But, when I omit the LIKE statements, it runs the WHERE clauses just fine.
Here is how my like statement is setup:
$this->db->like('id', $search)
->or_like('first_name', $search)
->or_like('last_name', $search)
->or_like('email_address', $search)
->or_like('company', $search)
->or_like('address', $search)
->or_like('note_promotion', $search)
->or_like('note_experience', $search);