Hi, is it possible to put classes in SESSION variables ?
I've created a class named ObjContratto that I use in this way:
$myContr = new ObjContratto;
$myContr->settore = 10;
now I need to use the same object, $myContr, in another page. So I put
it in a SESSION variable in this way:
session_start() ;
$_SESSION['contr'] = $myContr;
and retrieve the _same_ object from another page in this way:
session_start() ;
$myContr = $_SESSION['contr'];
but when I try to retrieve values from $myContr in this way:
$s = $myContr->settore;
it doesn't work, $s is sadly empty.
If I do an
echo $myContr;
it says "Object", so the session should work.
any idea?
tnx
darko
--
"Cosa sono i milioni, quando in cambio ti danno le scarpe ?"
I've created a class named ObjContratto that I use in this way:
$myContr = new ObjContratto;
$myContr->settore = 10;
now I need to use the same object, $myContr, in another page. So I put
it in a SESSION variable in this way:
session_start() ;
$_SESSION['contr'] = $myContr;
and retrieve the _same_ object from another page in this way:
session_start() ;
$myContr = $_SESSION['contr'];
but when I try to retrieve values from $myContr in this way:
$s = $myContr->settore;
it doesn't work, $s is sadly empty.
If I do an
echo $myContr;
it says "Object", so the session should work.
any idea?
tnx
darko
--
"Cosa sono i milioni, quando in cambio ti danno le scarpe ?"
Comment