title: php mysql getting count WHERE BETWEEN AND
body: <p>Hey i have a little problem when i'm trying to get count of rows from table, where <code>date</code> is <code>BETWEEN 2012-09-01 AND 2012-09-32</code>...</p>
  
  <p>Could you please tell me where's the problem?</p>
  
  <pre><code>$month = date(m);
  $year = date(Y);
  $day_start = '01';
  $day_end = '32';
  
  $from = $year.'-'.$month.'-'.$day_start;
  $till = $year.'-'.$month.'-'.$day_end;
  
  $result1 = $mysqli-&gt;query("SELECT COUNT(id) FROM `dreams` WHERE dream_state='dream' AND date BETWEEN $from AND $till");
  $row1 = $result1-&gt;fetch_row();
  $this_dream = $row1[0]; 
  </code></pre>
  
  <p>i've tryed to convert the string to time and from time to date like this:</p>
  
  <pre><code>$from = strtotime($from);
  $from = date("Y-m-d",$from);
  
  $till = strtotime($till);
  $till = date("Y-m-d",$till);
  </code></pre>
  
  <p>but still doesn't work, so any ideas?</p>
  
  <p>Thank you.</p>