title: Yii Active Record function BETWEEN
body: <p>Whats the right way to use BETWEEN in Yii Framework?</p>
  
  <p>Code:</p>
  
  <pre><code>...
  $criteria = new CDbCriteria;
  $criteria-&gt;condition = 'datetime BETWEEN '.$datetimemin.' AND '.$datetimemax;
  $user = Users::model()-&gt;find($criteria); 
  ...
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>SQL: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '07:10:10 AND 2011-10-10 13:10:10)' at line 1. 
  </code></pre>