multiple get_where with or condition |
[eluser]inari[/eluser]
User guide is too poor for advanced usage, so if anyone knows how to produce this sql query with get_where() method: "select x from y where x = 1 or x = 2" Trying... $this->db->getWhere('y',array('x' => 1, 'x' => 2)); not working... it seems like it creates AND condition, but how to use OR with this method ? Second question: is there somewhere some 'real' api manual, not just how-to-use user guide?
[eluser]m4rw3r[/eluser]
http://ellislab.com/codeigniter/user-gui...ecord.html somewhere under selecting data.
[eluser]Crazy88s[/eluser]
[quote author="inari" date="1208217344"]User guide is too poor for advanced usage, so if anyone knows how to produce this sql query with get_where() method: "select x from y where x = 1 or x = 2" Trying... $this->db->getWhere('y',array('x' => 1, 'x' => 2)); not working... it seems like it creates AND condition, but how to use OR with this method ? Second question: is there somewhere some 'real' api manual, not just how-to-use user guide?[/quote] From the user guide: $this->db->or_where(); This function is identical to the one above, except that multiple instances are joined by OR: So since or_where is identical to where you can use the example from the user guide: $array = array('name' => $name, 'title' => $title, 'status' => $status); $this->db->or_where($array); // Produces: WHERE name = 'Joe' OR title = 'boss' OR status = 'active' Look for $this->db->or_where(); at http://ellislab.com/codeigniter/user-gui...ecord.html and look for example #3 right above it. |
Welcome Guest, Not a member yet? Register Sign In |