Hi all,
I have used join query i got 2 fields only displayed on view insteed of 4 fields, i have mentioned my code below i have been facing this issue 3 days please any one help me.
My model code : (Mapmerchantid.php)
function getData() {
$sql = "SELECT a.uid,mid,dbaname,sponsor_bank from pd_user_mid_mapping a LEFT JOIN pd_user b on a.uid = b.uid";
$data = Yii::app()->db
->createCommand($sql)
->queryAll();
return $data;
}
My controller code:(MapmerchantidController.php)
public function actionAdmin()
{
$model=new Mapmerchantid('search');
$data_combine = Mapmerchantid::model()->getData();
//print_r($model);
$model->unsetAttributes(); // clear any default values
if(isset($_GET['Mapmerchantid']))
$model->attributes=$_GET['Mapmerchantid'];
$this->render('admin',array(
'model'=>$model,'datacombine'=>$data_combine
));
}
My view code :(admin.php)
<?php $this->widget(‘zii.widgets.grid.CGridView’, array(
'id'=>'mapmerchantid-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
'uid',
'mid',
array(
'name'=>'dbaname',
'value'=>'$data_combine->dbaname',
),
array(
'name'=>'sponsor_bank',
'value'=>'$data_combine->sponsor_bank',
), array(
'class'=>'CButtonColumn',
),
),
)); ?>
I got the out put on the grid for UID and MID, dbaname and sponsor_bank will be displayed as plank here with i have attached my screen pls any one help me.