Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CodeIgniter get_where() column IS NOT NULL [duplicate]

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?

like image 767
Jurudocs Avatar asked May 15 '26 20:05

Jurudocs


1 Answers

You can simply write the WHERE clause manually like this:

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

This will produce the following rendered SQL (tested on CI3; quoting will may differ by database driver).

SELECT *
FROM `navigation`
WHERE `linkname` IS NOT NULL
like image 158
Colin Brock Avatar answered May 17 '26 10:05

Colin Brock



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!