How to call query function in Bonfire model? How to call query function in Bonfire model? codeigniter codeigniter

How to call query function in Bonfire model?


In your Model Query method i made few changes,

function get_customerlist()    {        $selelct = array('first_name','last_name','customer_id');        return $this->db->select($select)                       ->from('customers')                       ->get()                       ->result();       }

In your Controller,

public function listCustomer() {  $this->load->model('customers_model'); // whatever you call it  $list = $this->customers_model->get_customerlist();  $data['list'] =  $list; //returned result is an array of object  $this->load->view('myview', $data);}

In Your view,try this,

foreach((array)$list as $item){     echo  $item->first_name. '<br />';}

It should work.