I’ve got a table like this.
[id] [name] [age]
1 foo 20
2 bar NULL
If i need to return all the rows when age’s fields is NULL i do the following and it works fine.
$this->db->from('person')->where('age', null);
The problem is that i need to do the opposite, i mean, return all rows when the age fields are not null values.
In SQL i do something like this
SELECT * FROM person WHERE age is not null
How do i do this using CodeIgniter ActiveRecord ??
Any help appreciated.
You may use:
If you curious how this happens see
system/database/DB_active_rec.phpAnd
system/database/DB_driver.phpAs a result you could pass just first parameter to
where()method and if first operator of this method has a sub stringis not nullit will be left untouched.To read more – CodeIgniter forum