にNULLではありません:CodeIgniterので値Iは、次のステートメントを作成しようとしていますCodeIgniterの
select * from donors where field is NOT NULL;
を、私のコードは次のようになります。
$where = ['field' => NULL];
$this->db->get_where('table', $where);
にNULLではありません:CodeIgniterので値Iは、次のステートメントを作成しようとしていますCodeIgniterの
select * from donors where field is NOT NULL;
を、私のコードは次のようになります。
$where = ['field' => NULL];
$this->db->get_where('table', $where);
あなたがdocumentationを見たときにあなたがして$this->db->where()
を使用することができます3番目のパラメータは、クエリをエスケープしないようにFALSEに設定されています。 例:
$this->db->where('field is NOT NULL', NULL, FALSE);
それとも、この
$where = "field is NOT NULL";
$this->db->where($where);
のようなカスタムクエリ文字列を使用することができますが、だからあなたのクエリビルダは、次のようになります。
$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');
試してみよう:
$this -> db -> get_where('donors', array('field !=' => NULL));
[Codeigniter Where句の複製](http://stackoverflow.com/questions/10109047/codeigniter-where-clause) – vhu