nerhael
04-01-2004, 04:36 PM
Okay, here's the deal, I store a usersession type object in the $_SESSION var.
Currently, to use it, I use
$userId = $_SESSION['user']->userId;
What I wanted to do was write a simply function to return that object.
function getUser() {
return $_SESSION['user'];
}
So that I could then use:
$userId = getUser()->userId;
however...this doens't work, something about calling a member function on a non object... This is pissing me off, because to me, those 'should' be equivalent statements pretty much.
If someone can tell me how to get this to work properly, it would be greatly appreciated.
Pete.
Currently, to use it, I use
$userId = $_SESSION['user']->userId;
What I wanted to do was write a simply function to return that object.
function getUser() {
return $_SESSION['user'];
}
So that I could then use:
$userId = getUser()->userId;
however...this doens't work, something about calling a member function on a non object... This is pissing me off, because to me, those 'should' be equivalent statements pretty much.
If someone can tell me how to get this to work properly, it would be greatly appreciated.
Pete.