RE: [PHP] Some SESSION Vars not Registering
| From: | Ow Mun Heng | Date: | Wed, 23 Jul 2003 10:26:30 +0000 |
| Subject: | RE: [PHP] Some SESSION Vars not Registering | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-156421@lists.php.net to get a copy of this message | ||
I'm new but.. aren't you also supposed to register the session??
My code ..
session_start();
session_register('username');
$_SESSION['username'] = $row['username'];
session_register('user_id');
$_SESSION['user_id'] = $row['user_id'];
session_register('access_level');
$_SESSION['access_level'] = $row['access_level'];
Cheers,
Mun Heng, Ow
H/M Engineering
Western Digital M'sia
DID : 03-7870 5168
-----Original Message-----
From: Jeff Stillwall [mailto:jstill@audioengine.net]
Sent: Wednesday, July 23, 2003 12:02 PM
To: Tom Rogers; Warren Vail
Cc: php-general@lists.php.net
Subject: Re: [PHP] Some SESSION Vars not Registering
"Tom Rogers" wrote:
> I am sure they do not but....
> I just tried reading the docs and it is as clear as mud so its back to
> the suck it and see method
From the on-line docs, regarding $_SESSION (at
http://us3.php.net/manual/en/reserved.variables.php#reserved.variables.sessi
on):
"This is a 'superglobal', or automatic global, variable. This simply means
that it is available in all scopes throughout a script. You don't need to do
a global $_SESSION; to access it within functions or methods, as you do with
$HTTP_SESSION_VARS."
So, this gets more perplexing.
I should also note that I did try to use the global keyword, and it didn't
help. Also, I tried setting the $_SESSION variables in question to
something else ($_SESSION["fname"] = " ") before calling the function.
Didn't help either.
I have just never had a problem with sessions before. But I'm guessing it's
my code, as I can replicate the behavior on three different installations of
PHP/Apache.
--
Jeff Stillwall