Q: Executing queries in Yii php framework issue <?php 
   $month_total = Prices::model()->findAllBySql("SELECT  FORMAT(SUM(p.choice_price),2) as total FROM prices p WHERE MONTH(p.choice_date) = MONTH(CURRENT_DATE())");
   echo "<pre>"; var_dump($month_total); echo "</pre>"; exit();
?>

The query works if give the wanted result, but the result of the var_dump is:
array(1) {
  [0]=>
  object(Prices)#309 (12) {
    ["price"]=>
    NULL
    ["_new":"CActiveRecord":private]=>
    bool(false)
    ["_attributes":"CActiveRecord":private]=>
    array(0) {
    }
    ["_related":"CActiveRecord":private]=>
    array(0) {
    }
    ["_c":"CActiveRecord":private]=>
    NULL
    ["_pk":"CActiveRecord":private]=>
    NULL
    ["_alias":"CActiveRecord":private]=>
    string(1) "t"
    ["_errors":"CModel":private]=>
    array(0) {
    }
    ["_validators":"CModel":private]=>
    NULL
    ["_scenario":"CModel":private]=>
    string(6) "update"
    ["_e":"CComponent":private]=>
    NULL
    ["_m":"CComponent":private]=>
    NULL
  }
}

Any idea why I am getting this ? I want to use the finds functions from yii 

A: Try like this,
 foreach ($month_total as $t)
  echo $t['total'];


A: try like this
$c = new CDbCriteria();
$c->alias = "p";
$c->select = "FORMAT(SUM(p.choice_price),2) as total";
$c->condition = "MONTH(p.choice_date) = MONTH(CURRENT_DATE())";
$month_total = Prices::model()->findAll($c);

