When i use this in codeigniter it only selects the last array index
$array = array("status !=" => "deleted", "status !=" => "concept");
$this->db->where($array);
this is the result:
SELECT * FROM (`table`) WHERE `status` != 'concept'
Anyone knows why or knows a better way?
Since you’ve already figured out the reason for this on your own (you’re simply overriding the array key), you should use one of the following options:
You can either pass it all in as a string in the first argument:
Or you can make 2 separate method calls:
The first one is simpler, but the second one is safer.