私は Yii を使用しています。CGridView で更新アイコンをクリックすると、その後 (quwey 文字列で) 何も来ません。id=
URL?r=employes/update&id=
意見
<?php
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'employee-grid',
'dataProvider'=>$model->EmpList(),
'columns'=>array(
'employee_no',
....
'date_created',
array(
'class'=>'CButtonColumn',
'template'=>'{update} {delete}',
),
), ));
?>
何が問題ですか?
コントローラ
public function actionIndex()
{
// here is your code for this action
$model = new Emp;
// print_r ($_POST);
if(isset($_POST['Emp'])) {
..
..
$connection = Yii::app()->db2 ; //Connect with 2nd db.
..
..
$command1 = 'Insert Query' // Insert Query here
$cmd1 = $connection->createCommand($command1);
$cmd1->execute();
}
$this->render('index', array(
'model'=>$model,
'id'=>$model->extension,
));
}
public function actionUpdate($id)
{
$model=$this->loadModel($id);
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['Emp']))
{
$model->attributes=$_POST['Emp'];
if($model->save())
$this->redirect(array('view','id'=>$model->emp_id));
}
$this->render('update',array(
'model'=>$model,
));
}
モデル
class Emp extends DB2
{
public function getDbConnection()
{
//return self::getCCDbConnection();
return Yii::app()->dbcc;
}
..
..
..
public function ExtensionList()
{
$criteria=new CDbCriteria;
$criteria->select='emp_id,emp_type,..date_created';
$criteria->condition = "emp_type = 'USER'";
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
'pagination' => array( 'pageSize' => 5 ),
));
}
..
..
..
}