尝试获取非对象的属性时遇到PHP错误

时间:2020-06-05 21:58:46

标签: php codeigniter

我试图让老师的评论显示出来,但我不断收到此错误:

严重性:注意 消息:试图获取非对象的属性“ teacher_comment” 文件名:student / getstudent.php 行号:3148

模型

public function GetTeacherComment($student_id, $session_id) 
    {
        $this->db->select('*');
        $this->db->where('student_id', $student_id);
        $this->db->where('session_id', $session_id);
        return $this->db->get('teacher_comments')->row();
    }

控制器

$data['teacher_comment'] = $this->Comment_model->GetTeacherComment($id, $student_session_id);

视图

<span style=" bottom: -20px; position: relative;"> <color style="color:blue;"> CLASS TEACHER'S REMARK:</color> <b
                                                style="text-transform: uppercase;"><?php echo $teacher_comment->teacher_comment; ?> </b></span><br>

0 个答案:

没有答案