为数据表中的第0行第1列请求了未知参数'1'

时间:2019-01-06 09:19:21

标签: jquery datatable codeigniter-3

我正在使用CodeIgniter和数据表。我在列表中显示数据。如果数据库中有记录,则显示记录,但如果表中没有记录,则出现错误“第0行第1列的请求的未知参数'1'。” 我在“网络”标签中签到了{"draw":0,"recordsTotal":1,"recordsFiltered":1,"data":["0"]}

public function MembershipList(){
    $fetchclubfees = $this->Fees_model->MembershipList();

          $draw = intval($this->input->get("draw"));
          $start = intval($this->input->get("start"));
          $length = intval($this->input->get("length"));

            $recordsTotal = count($fetchclubfees);
            $recordsFiltered = count($fetchclubfees);

            $data = array(); 
            $n=1;
            if(!empty($fetchclubfees)){
           foreach($fetchclubfees as $row)  
           {  
                $sub_array = array();
                $sub_array[] = $n++; 
                $sub_array[] = $row->a;  
                $sub_array[] = $row->b;
                $sub_array[] = $row->c;
                $sub_array[] = $row->d;  
                $sub_array[] = '<button type="button" name="update" id="'.$row->m_id.'" class="btn btn-warning btn-xs update">Edit</button>';  
                $data[] = $sub_array;  

           }  
            }
            else{
                $data[]="0";
            }
           $output = array(  
           "draw"   => $draw,  
            "recordsTotal" =>$recordsTotal,  
            "recordsFiltered"  =>$recordsFiltered, 
            "data" =>     $data  
           );  
           echo json_encode($output);  

  }
  

DataTables警告:表id =成员列表-请求第0行第1列的未知参数'1'。有关此错误的更多信息,请参见http://datatables.net/tn/4

您能在这个问题上帮助我吗?

0 个答案:

没有答案