> -----Original Message-----
> From: Peter Beckman [mailto:beckman@;purplecow.com]
> Sent: 30 October 2002 04:09
> To: Seabird
> Subject: Re: [PHP-DB] losing my session variables
> Put "session_start()" somewhere in your code.

.. but make sure that "somewhere" is before you do any real output to your page!

> $_SESSION isn't set until you "start" your session.
> And don't set session variables by $_SESSION[foo] = bar;
> DO this:
> $foo = bar;
> session_register("foo");
> Much better.

No -- this is fraught with problems in current releases of PHP (most, if not all, of 
which will be fixed in 4.3).  Most particularly, the following caution appears at 

  "If you are using $_SESSION and disable register_globals, do not use 
session_register(), session_is_registered() and session_unregister(), if your scripts 
shall work in PHP 4.2 and earlier."

Since the default for 4.2.x is register_globals=off, this is a very pertinent warning!

Even with register_globals=on, there are other problems which make it best to stick to 
manipulating the values in $_SESSION directly, rather than using the "equivalent" 
global variables.



Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to