Codeigniter database date-compare
Two things. First, have you tried putting your where clause in quotes like this:
$this->db->where('event_start_date <=','DATE_ADD(NOW(),INTERVAL 7 DAYS )');
Second, if necessary just skip using the where function and put the entire query in like this:
$this->db->query('SELECT event_id,title,event_start_date,location FROM sd_events WHERE event_start_date <= DATE_ADD(NOW(),INTERVAL 7 DAYS )');
You can just use the first argument to do accept functions with the ->where.
$this->db->select('event_id,title,event_start_date,location');$this->db->where('event_start_date <= DATE_ADD(NOW(),INTERVAL 7 DAYS)', null);$query = $this->db->get('sd_events');
This should put it in your WHERE statement just asis. Otherwise, it'll wrap your "DATE_ADD" in single quotes which doesn't evaluate.