Problems with Active Record - 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: Problems with Active Record (/showthread.php?tid=1993) |
Problems with Active Record - El Forum - 07-10-2007 [eluser]Unknown[/eluser] Hello, I need some help with this problem, hope that someone can help me Ok, I need to do a query like this: Code: SELECT field WHERE field1='1' AND (field2='2' OR field3='3') How can I do this with Active Records class? Problems with Active Record - El Forum - 07-10-2007 [eluser]champs[/eluser] Code: $this->db->select('field'); HTH. And don't forget, when you do funky things like that in statements, you need to run DB::escape_str() on any input variables you use there, i.e.: Code: $this->db->where(sprintf("(foo='bar' OR baz='%s')", $this->db->escape_str($this-input->post('whee'))) Problems with Active Record - El Forum - 07-10-2007 [eluser]Unknown[/eluser] Thanks a lot, champs This solve all of my problems |