On Wed, 15 May 2002 04:02, Peter Atkins did align ASCII characters thusly:
> All,
>
> I really need help on this one... I have a class called "Profile" and I
> want to store the properties of this class in the session after I give them
> values shown below:
>
> Step 1:
>
> // set properties of class
> $objProfile = new Profile('1', 'John', 'Doe') ;
> // store object in session
> $_SESSION["ProfileObj"] = $objProfile;
What's wrong with;
session_register( "objProfile" );
$objProfile = new Profile('1', 'John', 'Doe');
> This is what my session file looks like:
> !SESSION|ProfileObj|O:7:"profile":5:s:7:"staffId";s:1:"1";s:9:"firstName";s
>: 5:"John";s:8:"lastName";s:6:"Doe";}
Out of interest, does anyone know what the SESSION variable is and why it's
not set?
>
> Is there a way to store this in the session successfully and if so how can
> I do access it later?
Yes, include the class declaration on every page where you wish to use the
object i.e. require "profile.class.php" (and use session_start() on every
page of course).
Cheers,
Brad
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php