消息:试图获取非对象的属性“ Cls_Class”

时间:2018-08-24 20:20:31

标签: php codeigniter-3

遇到PHP错误

  

严重性:通知

     

消息:试图获取非对象的属性“ Cls_Class”

     

文件名:admin / edit_class.php

     

行号:42

控制器:类

public function edit($id)
{

  $data=array();
  $data['Cls_Classid']=$id;
  $this->load->view("admin/admin_header");
  $this->load->view("admin/admin_sidebar");
  $data['t_classes']=$this->ClassesModel->getClass($id);

    $this->load->view("admin/edit_class",$data);
    $this->load->view("admin/admin_footer");
}

模型:类模型

public function getClass($id)
    {
        $this->db->query("SELECT * FROM t_classes INNER JOIN t_teachers ON t_classes.Cls_Teacherid=t_teachers.Tch_Teacherid and t_classes.Cls_Classid = $id ;");
        $query = $this->db->get('t_classes');
        return $query->result();

    }

查看:edit_class

<input type="number" name="c_name"  class="form-control" value="<?php echo $t_classes->Cls_Class;?>">

0 个答案:

没有答案