php - How to get the result of query bulider in View Yii? -
i have action this:
public function actionupdate_daily($id) { $model = new timesheet('searchbyvoyage'); $model->unsetattributes(); // clear default values if (isset($_get['timesheet'])) $model->attributes = $_get['timesheet']; $modelvoyage = $this->loadmodelvoyage($id); //$vo = $this->loadvo($id, $id_voyage_order); $command = yii::app()->db->createcommand( "select a.id_timesheet, a.id_voyage_order, coalesce(b.duration,0) duration timesheet left join ( select x.* , max(y.id_timesheet) previous timesheet x join timesheet y on y.id_voyage_order = x.id_voyage_order , y.id_timesheet < x.id_timesheet group x.id_timesheet ) b on b.previous = a.id_timesheet a.id_voyage_order =".$id) ->queryall(); /// var_dump($command); // die(); // yii::app()->params['myvar'] = $command; $this->render('update_daily', array( 'model' => $model, 'modelvoyage' => $modelvoyage, 'command' => $command )); }
and want show result of query in view file update_daily.php using widget column duration :
$this->widget('bootstrap.widgets.tbgridview', array( 'columns' => array( 'name'=> 'duration', 'value'=> $command, ),
)
but, doesn't work , error.
you can refer link print , check whether query current or not
also use
print_r($command);die();
above render check result return query
Comments
Post a Comment