2017-11-15 2 views
0

컨트롤러은 다음과 같습니다이 오류를 해결하는 방법 - 심각도 : 알림 메시지 : 정의되지 않은 변수 : 테이블을

public function index() { 
    if ($this->session->userdata ('logged_in')) { 
     $condition = array(
      'qes_status'=>'Y' 
     ); 
     $data = array(); 
     $data['orders'] = $this->common_model->get_all('qes_order'); 
     $id=$this->session->userdata('user_id'); 
     $table['quote'] = $this->common_model->get_count_of($id); 
     $this->load->view ('layouts/inc_header'); 
     $this->load->view ('layouts/dashboard',$data,$table); 
     $this->load->view ('layouts/inc_footer'); 
    } else { 
     redirect ('vendor', 'refresh'); 
    } 
} 

보기은 다음과 같습니다

<div class="dash-box-body"> 
    <span class="dash-box-count"><?php echo $table?></span> 
    <span class="dash-box-title">Quotes Awaited</span> 
</div> 

모델입니다 :

public function get_count_of($id){ 
    $this->db->select ('*'); 
    $this->db->from ('qes_quote'); 
    $this->db->where ('qes_vendor_id',$id); 
    $query = $this->db->get(); 
    return $query->num_rows(); 
} 

이것은 내 코드입니다. 오류은 다음과 같습니다.

심각도 : 알림 메시지 : 정의되지 않은 변수 : 표.

문제를 해결하는 데 도움을주십시오.

답변

0

당신은보기에 $table 전달해야합니다

$data['table'] = $table; 
$this->load->view('view', $data); 

그리고 그것은 $table처럼 보이는 때문에 배열이보기에,이다 :

<span class="dash-box-count"><?php echo $table['quote'];?></span>