Welcome Guest, Not a member yet? Register   Sign In
printing model object with print_r, not the entire CI-object
#1

[eluser]zilverdistel[/eluser]
hi, when i run the following code in my controller, instead of only the object Gebruiker, I get the whole CI-object in the logfile it seems. I'm trying to figure this out, but I'm stuck. What I want is to print the Gebruiker object, not the entire CI-object. How can I do this?

Code:
// create a new user object
$this->load->model('user');
$newUserCreated = $this->user->init($form_username,$form_password);
$user =& $this->user;
// if a new user object has been created
if (false != $newUserCreated)
    {    // pass the user to the application object
        $this->application->setUser($user);
        log_message('debug','user: '.print_r($user,true));
    }

in the model User:

Code:
function init($name,$password)
    {
        $this->name = $name;
        return true;
    }
#2

[eluser]zilverdistel[/eluser]
Could the reason behind all this be that my User object inherits all the properties and methods from the model class? I really don't know how to do this.




Theme © iAndrew 2016 - Forum software by © MyBB