title: Yii query not returning null when table is empty
body: <p>I have an empty table tbl_rating that has user_id and post_id columns in it. In my Post view, I am trying to check to see if the post being viewed has already been rated by the user viewing it. I'm using the following in the view.</p>
  
  <pre><code>&lt;?php
  $sql='SELECT * FROM tbl_rating WHERE post_id='.$model-&gt;id.' AND user_id='.Yii::app()-&gt;user-&gt;getId().';';
          $connection=Yii::app()-&gt;db;
          $command=$connection-&gt;createCommand($sql);
          $query=$command-&gt;query();
  if($query != null):
  ?&gt;
  &lt;p&gt;You've already rated this post.&lt;/p&gt;
  </code></pre>
  
  <p>However, when I view any post, it says "You've already rated this post." even though there are no ratings. Does the query method return something other than null when it doesn't find any rows in the table?</p>