0

how to load multiple model in codigniter

class c_home extends CI_Controller {

         function __construct(){
           parent::__construct();

           $this->load->model('mhome/m_home');
           $this->load->model('mcommon/m_common');

         }

i have two model m_home and m_common m_home load but m_common not loaded give Error Message: Undefined property: c_home::$m_common

3
  • Not clear about your question but this might help you. stackoverflow.com/questions/6902966/… Commented Nov 22, 2012 at 14:31
  • i have two model m_home and m_common m_home load but m_common not loaded give Error Message: Undefined property: c_home::$m_common Commented Nov 22, 2012 at 14:37
  • Can you post c_home? The error is not in the loading of your model, but in the model itself. Commented Nov 22, 2012 at 14:44

2 Answers 2

2

Check if the model correctly extends the CI_Model for m_common

example:

 class M_common extends CI_Model{    

 }
Sign up to request clarification or add additional context in comments.

Comments

2

you can try this way for load multiple model :

function __construct(){
   parent::__construct();

    $this->load->model(array('mhome/m_home','mcommon/m_common'));

}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.