[eluser]Unknown[/eluser]
Hello,
I'm moving some code into the 2.0 framework. I have a MY_Model class, which I have moved into application/core.
class MY_Model extends CI_Model {
function __construct() {
parent::__construct();
...
I have several classes which extend this Model, like this one:
class News extends MY_Model {
public function __construct($id=0) {
parent::__construct();
...
My problem is, whenever I load one of my models, like this:
$this->load->model('news', '', true);
$n = new news(4);
I cannot access the db property. Calls to $this->db->query give me the error:
Fatal error: Call to a member function query() on a non-object in C:\Apache\htdocs\nhl\application\models\news.php on line 18
I have no problem connecting to the db if I don't use MY_Model. Any ideas?
Thanks!