Me Myself
Me Myself

Reputation: 185

Call to undefined method, Database error

Can anybody tell me what's wrong with my code? It said that the problem is in the controller, on line 13. Please help

Controller

function __construct()
{
    parent::__construct();
    $this->load->helper('url');
    $this->load->model('model_databis'); //line13
}

function index(){
    $data=array('data' => $this->model_databis->bus());
    $this->load->view('admin/databis',$data);
}

Model

class Model_databis extends CI_Model{
    function __construct(){
        parent::__construct();
    }
    function dbis(){
        $query = $this->db->get('bus');
        return $query->result_array();
    }
    function tambah($data){
       $this->db->insert('bus', $data);
       return TRUE;
    }
}

Upvotes: 0

Views: 95

Answers (1)

NikuNj Rathod
NikuNj Rathod

Reputation: 1658

You can try this solution for your problem :

Please change your function name in controller.

function index(){
    $data=array('data' => $this->model_databis->dbis()); // bus into dbis
    $this->load->view('admin/databis',$data);
}

Upvotes: 2

Related Questions