未定义的偏移量:0 yii

时间:2015-01-29 04:06:53

标签: php yii

在以下代码中,我收到此错误:

  

未定义的偏移量:C中的0:... \ PolizaController.php第173行

文件包含以下内容:

 public function actionUpdate($id)
    {
    $model=$this->loadModel($id);
        $connection=Yii::app()->db;
        $sql = "SELECT 
            cliente.comp_seguros
            FROM 
            cliente
            WHERE 
            cliente.nit_cliente = '".$model->nit_tomador."';";
        $command = $connection->createCommand($sql); 
        $dataReader=$command->query();         
        $rowsCliente=$dataReader->readAll();
        $model->comp_seguros = $rowsCliente[0]['comp_seguros'];
        if(isset($_POST['poliza'])) {
              $colAnterior=$model->nit_tomador;
              $model->attributes=$_POST['poliza'];
              if($model->nit_tomador!=$colAnterior){
                $connection=Yii::app()->db;
                $sql = "SELECT 
                        cliente.contador_polizas+1 as contador_polizas
                        FROM 
                        cliente
                        WHERE 
                        cliente.nit_cliente = '".$model->colegio."';";
                $command = $connection->createCommand($sql);           
                $dataReader=$command->query();         
                $rows=$dataReader->readAll();
                $model->num_carne = $rows[0]['contador_polizas'];
        }

0 个答案:

没有答案