![]() |
Help with Active Records - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Help with Active Records (/showthread.php?tid=47012) |
Help with Active Records - El Forum - 11-23-2011 [eluser]Unknown[/eluser] Hi! I'm submitting a query that looks something like this: Code: $this->db->select('fname,nick,lname,member_class'); When I check the SQL that is generate by the code above, I get something like this: SELECT `fname`, `nick`, `lname`, `member_class` FROM (`member`) WHERE `member_class` != 'Class A' AND `fname` LIKE 'do%' OR `nick` LIKE '%do%' OR `lname` LIKE 'do%' But with the query above, I keep getting people that have 'do' in their names and a Class A member class, which is not what I want. Is there a way that I can generate this: SELECT `fname`, `nick`, `lname`, `member_class` FROM (`member`) WHERE `fname` LIKE 'do%' OR `nick` LIKE '%do%' OR `lname` LIKE 'do%' AND `member_class` != 'Class A' with active records? Or better yet, will I be able to generate this with Active Records: SELECT `fname`, `nick`, `lname`, `member_class` FROM (`member`) WHERE (`member_class` != 'Class A') AND (`fname` LIKE 'do%' OR `nick` LIKE '%do%' OR `lname` LIKE 'do%') |