我的模型函数是
public function getUser()
{
$this->db->select(array('customer_name','customer_address','phone_no','fax','email_id','contact_person_name','mobile_no'));
$this->db->from('add_customer');
$this->db->where(array('status'=>1));
$res = $this->db->get();
if($res->num_rows() > 0)
{
$rows = $res->result_array();
return $rows;
}else{
return false;
}
}
控制器中的功能
public function search_customer()
{
//$this->load->helper('url');
$data['baseurl'] = base_url();
$this->load->view('templates/header');
$data['details'] = $this->Customer_model->getUser();
$this->load->view('master/customer',$data);
}
从我的视图中提取的数据是这样的
<?php for($i=0;$i<count($details);$i++){ ?>
<tr>
<td><?php echo ($i+1); ?></td>
<td><?php echo $details[$i]['customer_name']; ?></td>
<td><?php echo $details[$i]['customer_address']; ?></td>
<td><?php echo $details[$i]['phone_no']; ?></td>
<td><?php echo $details[$i]['email_id']; ?></td>
<td><?php echo $details[$i]['contact_person_name']; ?></td>
<?php }?>
这会导致这样的错误
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: details
Filename: master/Customer.php
Line Number: 69
有人请告诉我为什么会出现这个错误