params wont replace in condition

for some reason the params array wont replace the parameters I set in the conditions -




$Criteria = new CDbCriteria();

$Criteria->select = "{$this->title}, DAYOFMONTH({$this->date}) AS {$this->date}"; 

$Criteria->condition = "MONTH({$this->date}) = :month AND ({$this->date}) = :year ";

$Criteria->params = array(':month' => $this->month,':year' => $this->year);

$entries = CActiveRecord::model($this->dataProvider->modelClass)->findAll($Criteria);



when I check the log I see the query -


Querying SQL: SELECT title, DAYOFMONTH(createTime) AS createTime FROM `Entry` WHERE MONTH(createTime) = :month AND (createTime) = :year 

any one has any idea how to make this work ?

In config/main.php in ‘db’ section add




      'enableParamLogging'=>true,



Thanks it’s working now.

another question.

is it possible to fetch data from the database to a non existent column name using AS.

as you can see from my query I give the DAYOFMONTH(createTime) the name createTime to get the data.

befor that I tried to give the column a diffrennt name, like “DAYOFMONTH(createTime) AS day”, but it didn’t fetch the column

in the results