This question already has an answer here:
- Yii CDbCommand create query 1 answer
Does anybody know how to use the andWhere() condition in yii. I'm getting the below error when i use it.
CDbCommand and its behaviors do not have a method or closure named "andWhere".
here is sample code
$result=Yii::app()->db->createCommand()
->select()
->from('{{product}}')
->andWhere('price>:param1', array(':param1'=>150))
->andWhere('price<:param2', array(':param2'=>210))
->queryAll();
The
andWhere()
function is added in yii 1.1.13. It seems you are using older version of yii. Update the frameworkhow about trying this method , it's a easy peazy
or even
to be exact