Re: Newbie :: Class instance alive between pages??
| From: | Palli | Date: | Wed, 08 Jan 2003 20:00:49 +0000 |
| Subject: | Re: Newbie :: Class instance alive between pages?? | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-17726@lists.php.net to get a copy of this message | ||
So what is wrong with this code :
This is page 1 :
$MyFrett = new cFrett;
$_SESSION['cFrett'] = $MyFrett;
this is another page that is trying to use the class instance :
<?php
if (empty($_SESSION['cFrett']))
{
echo 'the session object is empty';
}
else
{
include("clsFrett.php");
$MyFrett = new cFrett ;
$MyFrett = $_SESSION['cFrett'];
$MyFrett->NewNews();
}
?>
thanx
Palli
"Luis Ferro" <lferro@teladigital.net> wrote in message
news:3E1C512B.4020201@teladigital.net...
Yes, it is, but prior to accessing the stored value you will have to
include the class file, otherwise, php will not know what object that
thing in the session is...
LF
Palli wrote:
>Hello
>
>I´m wondering how I keep class instance alive between pages. Is it
possible
>to store it in Session and what is the "right" way to store it globaly?
>
>thanx Palli
>
>
>
>
>
---
[This E-mail scanned for viruses by Declude Virus]