Quote
Call to a member function getData() on a non-object in View file
please help me spot the error and fix it.
in controller:
public function actionIndex()
{
$model=new Search;
if(isset($_POST['Search']))
{
$searchresult = Yii::app()->db->createCommand()
->select('p.product_id, p.product_name, r.price, p.master_key')
->from('tbl_product_index p')
->join('tbl_pricing r', 'p.product_id=r.product_id')
->where('master_key=:master_key', array(':master_key'=>$_POST['Search']['brand']['1']))
->queryRow();
$dataProvider=new CArrayDataProvider($searchresult);
$this->render('view',
array(
'dataProvider'=>$searchresult,
)
);
}
$this->render('index',array('model'=>$model,));
}
in view:
<?php
$dataArray = $dataProvider->getData();
foreach ($dataArray as $data){
echo CHtml::encode($data->product_id);
}
?>

Help














