Jurudocs
Jurudocs

Reputation: 9185

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?

Upvotes: 3

Views: 11661

Answers (4)

Raham
Raham

Reputation: 4951

Try this one...

$this->db->select("*)
->from("table_name")
->where("your_id <>",'');

Upvotes: 0

St&#233;phane Bourzeix
St&#233;phane Bourzeix

Reputation: 410

It's :

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

Upvotes: 1

Colin Brock
Colin Brock

Reputation: 21575

You can simply write the WHERE clause manually like this:

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

Upvotes: 12

csotelo
csotelo

Reputation: 1485

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

Upvotes: -2

Related Questions