I am new to yii, while executing the query ,I am getting the numbers of rows selected but not the the actual selected data.
Hows can i get the actual data selected.
$sql = "SELECT DISTINCT a.CONTENT_ID,a.CONTENT_TITLE
FROM TBL_CONTENT_DETAILS a JOIN TBL_CONTENTS b
ON a.CONTENT_ID=b.CONTENT_ID
WHERE (b.CONTENT_TYPE_ID =22 or b.CONTENT_TYPE_ID=53)
and a.CONTENT_ID not in ($notin)";
$connection = Yii::app()->db2;
$command = $connection->createCommand($sql);
$res = $command->execute();
$notin contains comma separated integer id’s.
Use
$command->queryAll();insteadexecute()will always return the number of affected rows, whereasfetchAll()will get you an array of results.http://www.yiiframework.com/doc/api/1.1/CDbCommand/#queryAll-detail