CodeIgniter-MY_Model icon indicating copy to clipboard operation
CodeIgniter-MY_Model copied to clipboard

How to write: WHERE [field] IS NULL

Open dreammonkey opened this issue 9 years ago • 2 comments

Works: $this->db->where('field IS NULL'); $result = $this->get_all();

DOES NOT WORK: $result = $this->where('field', NULL)->get_all(); $result = $this->where('field is', NULL)->get_all(); $result = $this->where('field IS NULL')->get_all(); $result = $this->get_all('field is null');

dreammonkey avatar Jul 06 '16 10:07 dreammonkey

You need to make the where clause a custom string like this:

$result = $this->where('fieldName IS NULL',NULL,NULL,FALSE,FALSE,TRUE)->get_all();

salain avatar Jul 06 '16 12:07 salain

it causing serious problem, and generated headaches to me described here #295

nuryagdym avatar Dec 19 '19 15:12 nuryagdym