CodeIgniter Forums
multiple where_in - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: multiple where_in (/showthread.php?tid=5288)

multiple where_in - El Forum - 01-15-2008

Heym I've just checkout the current CI version on the SVN and give it a try, but I had a problem...
My code

$this->db->where_in('id', array(1, 2, 3));
$this->db->where_in('name', array('Angola', 'Benin'));
$query = $this->db->get('country');
echo $this->db->last_query();

I´m getting that the executed query is:

SELECT * FROM (country) WHERE id IN (1, 2, 3) AND name IN (1, 2, 3, 'Angola', 'Benin')

So the first and the second where_in are getting mixed... Is there a restriction to one "in" statement per query, or is this a bug?

Also the examples are complitly wrong...
Quote:$names = array('Frank', 'Todd', 'James');
$this->db->where_in_or('username', $names);
// Produces: OR WHERE username IN ('Frank', 'Todd', 'James')
The method is wrong in the example, and the produces is an awful SQL sentence. The same thing happend in $this->db->or_where_not_in() and partially in $this->db->where_not_in()