Re: [PHP] array in sessions

2001-12-17 Thread Nick Winfield

On Tue, 18 Dec 2001, Gregor Jaksa wrote:

 Hello,

 is it possible to register array in session .. something like that:
 session_register(ex_array[field1]);
 session_register(ex_array[field2]);

 this example of course doesnt work :), so if anyone knows a solution, plz
 tell

Why not just store the whole array, like this ::

?php
session_start();
session_register(sports);
$sports = array(tennis, soccer, hockey, basketball);
?

Cheers,

Nick Winfield - [ http://www.pi0.org/ ]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] array in sessions

2001-03-27 Thread Yasuo Ohgaki

"Christian Dechery" [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 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



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]