Can somebody help me, I am new in CI, and I don't know what do I do wrong.
I have this kind of controller
main
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class main extends CI_Controller {
public function index() {
$this->home();
}
public function home() {
$this->load->helper('url');
$this->load->model("get_db");
$data['results']=$this->get_db->getAll();
$this->load->view("view_home", $data);
}
}
And the model get_db
like this
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class get_db extends CI_Model {
public function getAll() {
$query=$this->db->query("SELECT * from tekstovi");
return $query->result();
}
}
I got this strange error like this
**A PHP Error was encountered
Severity: Notice
Message: Undefined property: main::$db
Filename: core/Model.php
Line Number: 51**
Any idea what to correct?