Page 1 of 1
Multiple sessions
Posted: Wed Nov 10, 2004 3:51 am
by appu
Hai Friends,
I need to maintain more sessions in the project.
Is there any possibility to maintain more than one session in the project.
Please give me an advice.
Thank you friends,
Posted: Wed Nov 10, 2004 5:39 am
by josh
What is the reason for multiple sessions..
if it is hold multiple variables in the session with the same name you could do this:
since the session variable is an array $_SESSION['key']=$value; you could do $_SESSION['session_one']['varialbe']=something and $_SESSION['session_two']['var']=somethingelse; .... read up on working with multi-demensional arrays
Code: Select all
<?php
session_start();
?><pre><?
$_SESSION['test']['hi']="bye";
print_r ($_SESSION);
?></pre>
this should output:
Code: Select all
Array
(
їtest] => Array
(
їhi] => bye
)
)
You can alter the code an add on to it and do this:
Code: Select all
Array
(
їsession1] => Array
(
їusername] => blah
)
їsession2] => Array
(
їusername] => blah
)
)