Page 1 of 1
problem in fetching session var values...
Posted: Mon May 09, 2005 7:51 am
by itsmani1
Code: Select all
while($Row = mysql_fetch_object($Res))
{
$adminID = $Row -> adminID;
$HTTP_SESSION_VARS['adminID'] = $adminID;
$firstName = $Row -> firstName;
$HTTP_SESSION_VARS['firstName'] = $firstName;
$lastName = $Row -> lastName;
$HTTP_SESSION_VARS['lastName'] = $lastName;
$canAddProduct = $Row -> canAddProduct;
$HTTP_SESSION_VARS['canAddProduct'] = $canAddProduct;
}
see the above coad here in this coad i am registerign session vars. new i want to get the values of these session vars. how i will do that?
Posted: Mon May 09, 2005 9:31 am
by anjanesh
Normally $_SESSION works like this - in my scripts :
$_SESSION['somevariable'] = $somevariable;
echo $_SESSION['somevariable']
Posted: Mon May 09, 2005 5:23 pm
by Skara
Yeah, $HTTP_SESSION_VARS is the old way of accessing them. Use $_SESSION now.
Also, you might as well shorten each line to this:
Code: Select all
$_SESSION['adminID'] = $Row->adminID;
*shrugs*
$_SESSION acts just like any other variable in this sense:
Code: Select all
echo $miscvar;
// ~ or ~
echo $_SESSION['whatever'];
// ~ or ~
echo $_GET['something_else'];