CodeIgniter Forums
call load method from a model - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: call load method from a model (/showthread.php?tid=49067)



call load method from a model - El Forum - 02-07-2012

[eluser]joe_h[/eluser]
Hi, I need to call the load method from a class model and I get an error.

To call a class model from a model class to do?


call load method from a model - El Forum - 02-07-2012

[eluser]CroNiX[/eluser]
Do you have to do it from the model? It should really be done in the controller.
Code:
$this->load->model('user_model');
$this->load->model('account_model');

// get current user
$user = $this->user_model->get_user_data();

// get account data for current user by passing ID from previous model method.
$accounts = $this->account_model->get_user_account($user['id']);



call load method from a model - El Forum - 02-07-2012

[eluser]joe_h[/eluser]
Ok, thank you very much