Welcome Guest, Not a member yet? Register   Sign In
loading model from controller subfolder

I've got one problem .. I have a create a folder in controller folder, then I add a controller file. From there, I load a model in models folder ... and there are some error

I have search in forum about controller/model with subfolder but it didn't solve my problem ..

ohh, here's the code

if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class MY_Model extends Model{

public function __construct( ) {

public function read($column_name, $where = array() ){

    $value = $this->db->get($this->table);
    return $value->result_array();


class MUser extends MY_Model{

    public function __construct() {

* @property MUser $MUser
class Account extends MY_Controller {

    public function __contruct() {
        $this->load->language('user',$this->get_language() );
        if($this->session->userdata('user_id') == false){

    public function index() {

        $where = array('user_id' => $this->session->userdata('user_id'));

        //here's the error. line below is line 31
        $acc_data = $this->MUser->read('username, email, nickname', $where);


And here's the error message :

A PHP Error was encountered

Severity: Notice

Message: Undefined property: Account::$MUser

Filename: user/account.php

Line Number: 31

Fatal error: Call to a member function read() on a non-object in D:\CodeIgniter\Test\system\application\controllers\user\account.php on line 31

Why this error happen? I think there are any problem with creating folder inside controller folder ...

Try using Muser instead of MUser?

Theme © iAndrew 2016 - Forum software by © MyBB