Hi,
I am newbie to YII and loving to learn it. I have a query but i dont do where am I wrong
getting error to display best top 5 selling product in dsplayproduct.php which is in views/members
I have a member table wherein i have (id,productid,memberid) as column
in the member model i have a function
public function getDisplayProduct()
{
$sql="select productid ,count(*)from fc_member group by productid order by count(*) LIMIT 2";
$command=Yii::app()->db->createCommand($sql);
$displayproduct=$command->execute();
}
member controller
public function actiondsplayproduct()
{
$model=new Member;
$this->render('dsplayproduct',array('model'=>$model));
}
view/member/dsplayproduct
<?php
foreach($displayproduct as $value)
{
echo $value;
}
?>
the error appears stating
Undefined variable: displayproduct
Please can someone help me out to figure out this problem or let me know where am i going wrong and how can I resolve this problem