Re: Session Variables in a Class

From: Date: Tue, 09 Sep 2003 10:34:56 +0000
Subject: Re: Session Variables in a Class
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-162051@lists.php.net to get a copy of this message
Am Die, 2003-09-09 um 10.19 schrieb micro brew: > Hi everyone, > > I've been experimenting with sessions. I can make > them work just fine in a normal PHP page. But when I > create a class and try to define a session variable > within a method in the class it won't work. I've > tried setting the session variable directly > ($_SESSION['name']='somevalue') but that didn't work. > The normal way of setting it - > session_start(); > session_register('name'); > $name='somevalue'; > > - didn't work either (within the class). > > Am I just missing something obvious? Any suggestions? You have to include the class-definition _before_ you start the session. Read about it in the manual: http://www.php.net/manual/en/language.oop.serialization.php Hope that helps. -- Marco > TIA. > > Mike > > __________________________________ > Do you Yahoo!? > Yahoo! SiteBuilder - Free, easy-to-use web site design software > http://sitebuilder.yahoo.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#162051) next »