$critPost = "SELECT * FROM `post` `t` join `ss_individual` `p` ON `t`.`user_id` = `p`.`id` WHERE `t`.`del`=0 and `t`.`hide`=0 and `t`.`user_id`='".Yii::app()->user->id."' ORDER BY `t`.`posted_on` desc";
$modelPost = Yii::app()->db->createCommand($critPost)->queryAll();
print_r($modelPost); /* it works fine */
foreach($modelPost as $mp)
{
echo $mp->imgname; /* trying to get non property object */
}
Am joining two tables 'post' and 'ss_individual' and executing using Yii::app()->db->createCommand($critPost)->queryAll(). While displaying using print_r($modelPost). It works fine, but it showing error while using foreach().