title: MySQL query to show count of rows where date is in the past 30 days
body: <p>Pretty basic question, I need to show a count of items that were entered 30 days ago (compared to today/current timestamp). Also need to do the same for 60 and 90 days.</p>
  
  <p>I have:</p>
  
  <pre><code>$format = 'Y-m-j G:i:s'; 
  $d = date( $format, strtotime ( '-30 days' ) );
  $db-&gt;query_first("SELECT COUNT( * ) AS val FROM ".DB_TABLE."tickets WHERE entered &lt;= '$d'");
  </code></pre>
  
  <p>The <em>entered</em> row shows reflects the date the item was keyed into the db (ie 01/01/2012). Need to show a count of the items were entered 30, 60, and 90 days ago.</p>
  
  <p>Not sure if I'm on the right path...</p>