Search code examples
phpcodeigniteractiverecordquery-buildernotnull

CodeIgniter get_where() column IS NOT NULL


Somehow it's a bit difficult for me to build a query like this: "Give me all entries of navigation where linkname not null"

$query = $this->db->get_where('navigation',array('linkname'!==NULL));

Giving me Error

Unknown column '0' in 'where clause'

SELECT linkname, idnavigation FROM (navigation) WHERE 0 = 1

Any hints with this?


Solution

  • You can simply write the WHERE clause manually like this:

    $this->db->get_where('navigation', 'linkname IS NOT NULL');