Re: array in sessions

From: Date: Wed, 28 Mar 2001 07:02:23 +0000
Subject: Re: array in sessions
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-45839@lists.php.net to get a copy of this message
"Christian Dechery" <lemming@vento.com.br> wrote in message news:5.0.0.25.2.20010327223136.01fe1c90@pop-gw.vento.com.br... > How do I store (and update) an array within a session... > > Like I'd have > > <?php > session_start(); > $time["page1"]="20"; > > //here, should I do this? > session_register("time["page1"]"); > > //or this? > session_register("time"); It should work with this. FYI. If you set register globals off and enable track vars on in your php.ini. (It may work with other settings, but this is what I use)You don't even have to write $var = "session var"; session_register("var"); session_unregister("var"); Instead, you can write $HTTP_SESSION_VARS['var'] = "value you want to store in session"; unset($HTTP_SESSION_VARS['var']); // to unregister from session > > ?> > > cuz I'll have more pages... > $time["page20"]="300"; > > is this going to automatically load into the session vars or I have to do > something first? No. When I learn new languages, I usually write a lot of simple codes to make sure I correctly understands how it works. I suggest to do that. Regards, -- Yasuo Ohgaki

« previous php.general (#45839) next »