I'm using the MVC standard, and I need to declare the value of a variable inside the model file and I ended up doing this:
public $user_id = null;
public $user_name = "";
public $user_email = "";
public $user_is_logged_in = false;
public function doLoginWithPostData($user_name, $user_password) {
...
$this->user_id = $result_row->id;
$this->user_name = $result_row->username;
$this->user_email = $result_row->mail;
$this->user_is_logged_in = true;
...
}
However, when I am trying to display these variables in a controller, it simply appears with no value. Var_dump:
object(Model)#4 (5) { ["user_id"]=> NULL ["user_name"]=> string(0) "" ["user_email"]=> string(0) "" ["user_is_logged_in"]=> bool(false) ["db"]=> object(PDO)#3 (0) { } }
EDIT: I noticed that information is only lost when page mute