[eluser]Henry Weismann[/eluser]
How would I do this with active record?:
Code:
SELECT * FROM (`ww_syslog`) WHERE ( `type` = 'user' AND `user` = '1' ) AND (`ip` LIKE '%lk%'
OR `action` LIKE '%lk%'
OR `description` LIKE '%lk%'
OR `date` LIKE '%lk%') ORDER BY `date` desc LIMIT 5
Notice that we need to have the parentheses around all the OR's after the AND in order to limit the type and user but include the search phrase for ip, action, description and date.
Is this possible with the active record it seems it was not adding the parentheses and was therefore including all users.