hi
I have got below Error , I am using 2 times queryAll() in my controller action function.
CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1065 Query was empty. The SQL statement executed was:
This is my code
$sql='SELECT DISTINCT( year( date_purchased ) ) AS y FROM orders ORDER BY date_purchased DESC limit 2';
$connection=Yii::app()->db;
$command=$connection->createCommand($sql);
$order_years=$command->queryAll();
Yii::app()->db->setActive(false);
Yii::app()->db->setActive(true);
$prods_query_sql = "select * from users ";
$prods_data=$connection->createCommand($prods_query_sql)->queryAll();
Without last 2 line working fine
any one help me here ?
Thanks