Value IS NOT NULL in codeigniter
when you see documentation You can use $this->db->where()
with third parameter set to FALSE to not escape your query.Example:
$this->db->where('field is NOT NULL', NULL, FALSE);
Or you can use custom query string like this
$where = "field is NOT NULL";$this->db->where($where);
So your query builder will look like this:
$this->db->select('*');$this->db->where('field is NOT NULL', NULL, FALSE);$this->db->get('donors');
OR
$this->db->select('*');$where = "field is NOT NULL";$this->db->where($where);$this->db->get('donors');
If you have some a complex query with multiple where and Having condition.
Please find below example:
$this->db->select(['id', 'email_address', 'abandon_at','datediff(now(),`abandon_at`) AS daysdiff ' ]); $this->db->having('daysdiff < 11');$query = $this->db->get_where('forms', array('abandon_form' => 1,'abandon_at !=' => 'NULL') ); return $query->result();