客户模型
Class Customers_model extends BF_Model{
protected $table_name = 'customers';
protected $key = 'customer_id';
protected $date_format = 'datetime';
我在模型中的查询功能
function get_customerlist()
{
$sql = $this->db->query('SELECT first_name, last_name , customer_id FROM customers ');
return $sql->result();
}
}`
控制器
public function listCustomer()
{
$this->load->model('customers_model'); // whatever you call it
$data['list'] = $this->customers_model->get_customerlist();
$this->load->view('myview', $data);
}
看法
foreach($list as $value)
{
echo $value->first_name. '<br />'; output.
}
它无法显示$list
来自控制器的数组:未定义的列表变量