title: MySQL select rows from exactly 7 days ago
body: <p>I'm completely stumped on this one, being trying for hours but with no success, hoping someone can help. Trying to build a cron script to run daily that returns the rows that are exactly 7 days older than the current date.</p>
  
  <p>The thing is, my query is not returning anything. No error messges, nothing (I know there are entries in the DB from the last 7 days - we get about 7000 new entries a day, so they are there!) I've tried a SELECT * and echo out the edit date with success, so everything is working, apart from my SQL script.</p>
  
  <p>The column I'm referencing (edit_date) is type 'datetime' formated with Y-m-d h-m-s. This column always has a datetime value assigned on both create and edit. </p>
  
  <pre><code>function get_ad_sql($table){
      $sql = "SELECT 
                  * 
              FROM 
                  ".$table." 
              WHERE 
                  edit_date = DATE_SUB(NOW(), INTERVAL 7 DAY)
              ";  
      return $sql;
  }
  </code></pre>
  
  <p>And calling the function and 'trying' to echo the primary_key:</p>
  
  <pre><code>$sqlAng = get_ad_sql('angebote');
  $result = mysql_query($sqlAng);
  while($row = mysql_fetch_array($result)){
      echo $row['primary_key'];
  }
  </code></pre>
  
  <p>I've tried every variation of DATE_SUB(NOW(), INTERVAL 7 DAY), including CURDATE(), DATE_FORMAT(edit_date, '%m/%d/%Y') that I could find on here and online, but couldn't get anything to work. Hope someone can help me!</p>