'Codeigniter Call to a member function where() on bool

I tried to set seen to any contact data in database, but when i try that:

public function showMessage($id){
        $this->load->model('Message_Model');
        $messageData = $this->Message_Model->selectMessage($id);
        if($messageData[0]->messageIsSeen == 0){
            $this->Message_Model->setSeenToMessage($id);        
        }
        $data = array('messageData' => $messageData[0]);
        $this->load->view('Back/MessageDetail', $data);
    }

Model:

function setSeenToMessage($id){
        $this->db->update('messages', array('messageIsSeen' => 1))->where('messageId', $id);
        return 1;
    }

It throws that error enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source