Customers_model
Class Customers_model extends BF_Model{
protected $table_name = 'customers';
protected $key = 'customer_id';
protected $date_format = 'datetime';
My query function in model
function get_customerlist()
{
$sql = $this->db->query('SELECT first_name, last_name , customer_id FROM customers ');
return $sql->result();
}
}`
Controller
public function listCustomer()
{
$this->load->model('customers_model'); // whatever you call it
$data['list'] = $this->customers_model->get_customerlist();
$this->load->view('myview', $data);
}
View
foreach($list as $value)
{
echo $value->first_name. '<br />'; output.
}
It can't show $list
array from controller : Undefined list variable