title: MySQL SELECT rows between two values
body: <p>I need to select data from a mysql database from the past 12 months based on the current date. I have the dates saved in the database as unix timestamps but my query does not seem to work.</p>
  
  <pre><code>$query="SELECT user_id, COUNT(first_name) AS member_count
  FROM main_user
  WHERE renew_date&lt;'$time' AND renew_date&gt;'$old_time' WHERE renew_date!=''";
  </code></pre>
  
  <p>Basically I need to count all instances of first_name where there is a renew_date timestamp.</p>