Querying MySQL with CodeIgniter, selecting rows where field is NULL
Posted
by rebellion
on Stack Overflow
See other posts from Stack Overflow
or by rebellion
Published on 2010-03-22T00:56:55Z
Indexed on
2010/03/22
1:01 UTC
Read the original article
Hit count: 312
I'm using CodeIgniter's Active Record class to query the MySQL database. I need to select the rows in a table where a field is not set to NULL:
$this->db->where('archived !=', 'NULL');
$q = $this->db->get('projects');
That only returns this query:
SELECT * FROM projects WHERE archived != 'NULL';
The archived
field is a DATE
field.
Is there a better way to solve this? I know I can just write the query myself, but I wan't to stick with the Active Record throughout my code.
© Stack Overflow or respective owner