Welcome Guest, Not a member yet? Register   Sign In
multiple where_in
#1

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

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:

Code:
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...
$this->db->or_where_in();
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()




Theme © iAndrew 2016 - Forum software by © MyBB