Welcome Guest, Not a member yet? Register   Sign In
Load Model in my member variable in a model
#1

[eluser]Sarwar CSE[/eluser]
I want to this
Code:
class Muser extends CI_Model{
  var $userProfile;
  function __construct(){
      parent::__construct();
      $this->load->model('MuserPro','userProfile');
  }
}


in controller

class user extend CI_controller{
    function __construct(){
      parent::__construct();
      $this->load->model('Muser ');
      
    }
    function index(){
       print_r($this->Muser->userProfile);      // this is not show any thing......
    }
}

Please advice me
#2

[eluser]InsiteFX[/eluser]
Because you are not calling a method!
Code:
print_r($this->userProfile->method());      // this is not show any thing......

InsiteFX
#3

[eluser]Sarwar CSE[/eluser]
if i write like this
Code:
class Muser extends CI_Model{
  var $userProfile;
  function __construct(){
      parent::__construct();
      $this->load->model('MuserPro','uP');
      $this->userProfile=$this->uP;
  }
}
then the line "
Code:
print_r($this->Muser->userProfile);
" print this
MuserPro Object
(
[id] =>
[FName] =>
[LName] =>
[NName] =>
[Gender] =>
[State] =>
[Zip] =>
[Country] =>
[country_code] =>
[Tel] =>
[Email] =>
)
now in this code in the controller
Code:
function index(){
       print_r($this->Muser->userProfile);  
       // it show the object Structure of MuserPro......
      
       print_r($this->Muser->uP);
       // it should print the object Structure of MuserPro but it not print any think              
    }




Theme © iAndrew 2016 - Forum software by © MyBB