I’m trying to get all data which date is greater than or equal to today.
Here is what I do:
$this->db->select('id, name');
$this->db->where('dr', '1');
$this->db->where('end >=', 'CURDATE()');
$query = $this->db->get('store');
But it doesen’t work. What I wrong ?
Active Records automatically escapes your query, so CURDATE() will be passed as a string instead of using the mysql function.
You’d better off runing your query manually, something like
Or if you still want to use AR, you could pass a FALSE as third parameter of
$this->db->whereto avoid automatic escaping by CI: