RE: [PHP] Session Initially Doesn't Work
| From: | Adam Douglas | Date: | Thu, 02 May 2002 17:03:38 +0000 |
| Subject: | RE: [PHP] Session Initially Doesn't Work | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-95713@lists.php.net to get a copy of this message | ||
> > Alright that's good to hear. In a specific case that I'm having
> > this problem
> > the main PHP file is including file (content) that refers to
> > $_SESSION[nSID_PeopleID] in main. This value is vital in
> > rendering the page.
> > So it should be there right? Also about removing
> session_name(), how can I
> > do this. It was my understanding that you must call
> session_name before
> > session_start() and session_register(). Is this not correct?
>
> Ahhh, so that's your problem then....the include isn't
> getting the session
> id. I've never used an include with a session setup before
> but I would see
> the easiest thing to do be have the include first echo the
> session id number
> and see if it is actually getting passed or not on the first call
>
> echo session_id();
Yuppers. I played around with the echo session_id(); and found it was not
getting into the scope of the included file. So I removed all
session_register() and replaced it with $_SESSION['varname'] = 'value'; and
it solve the problem. Your not suppose (not recommended) to use
session_register() anways, right?
Thanks for the help!