Value IS NOT NULL in codeigniter
I am trying to create the following statement: select * from donors where field is NOT NULL; With codeigniter, my code looks like this: $where = ['field' => NULL]; $this->db->get_where('table', $where); 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)