0

My controller is:

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' );
    }
}

My view is:

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

My model is:

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 ();
}

This is my code. The error is:

Severity: Notice Message: Undefined variable: table.

Please help me to resolve the issue.

Don't Panic
  • 13,965
  • 5
  • 32
  • 51

1 Answers1

0

You need to pass $table to your view:

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

And since it looks like $table is an array, in your view:

<span class="dash-box-count"><?php echo $table['quote'];?></span>
Kisaragi
  • 2,198
  • 3
  • 16
  • 28