Php 消息:在将数据从cotroller传递到视图时尝试获取非对象的属性
我将模型中的函数编写为:Php 消息:在将数据从cotroller传递到视图时尝试获取非对象的属性,php,codeigniter,Php,Codeigniter,我将模型中的函数编写为: public function select() { $this->db->select('*'); $this->db->from('students'); $query = $this->db->get(); return $query->result(); } 和控制器为: public function edit() { $data['row']=$this->st
public function select()
{
$this->db->select('*');
$this->db->from('students');
$query = $this->db->get();
return $query->result();
}
和控制器为:
public function edit()
{
$data['row']=$this->student_model->select();
//print_r($data['row']);
$this->load->view('edit.php',$data);
}
它可以在控制器功能中打印数据..但在进入查看页面时,我得到的错误消息如下:
Message: Trying to get property of non-object
对于每个字段,都需要像这样在编辑页面中回显数据
echo $row[0]->field_name;
你的视图代码在哪里???