Re: connection from one page to another
gachsaran wrote:
> Hi
>
> I have a class that is my interface to mysql. I create an instance og
> class an connect to db. Then i change to another page and want to use
> the same instace of class. How can i send an object (the instance) to
> another page ?
>
Serialize it then pass it as you would any other variable. The receiving
script needs to include the class definition before you deserialize it (but
PHP5 can try automatically include a class file for an undefined class).
Actually you can get by without serializing it and passing it via the
seesion, but you can get strange complications doing this.
The resource cannot be passed out of the thread in which it was created -
see the sleep and wakeup functions.
C.
|