title: Codeigniter database date-compare
body: <p>Im having a problem comparing dates in a database to a week from now using activerecord. I'm trying to return a list of events with their start date less than a week from now.</p>
  
  <p>The event_start_date is in the format of 2011-06-30 09:00:00</p>
  
  <pre><code>$this-&gt;db-&gt;select('event_id,title,event_start_date,location');
  $this-&gt;db-&gt;where('event_start_date &lt;=',DATE_ADD(NOW(),INTERVAL 7 DAYS ));
  $query = $this-&gt;db-&gt;get('sd_events');
  </code></pre>
  
  <p>Having trouble working out the right syntax for this, any help would be appreciated :-)</p>