Re: How to keep db cursor during reloaded www?
| From: | Vitaly N. Kravchenko | Date: | Wed, 24 Jul 2002 14:10:02 +0000 |
| Subject: | Re: How to keep db cursor during reloaded www? | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-7940@lists.php.net to get a copy of this message | ||
Hello, Johann!
> Do anyone have any idea how to keep cursor during reloaded www pages?
> I tried to keep it in session variable but PHP cannot keep objects in
> sessions. So I tried to serialize it, but PHP cannot serialize
> resource_type (connection to database is resource type). Do anybody
> have any idea?
> I would like to serialize resource type variable. Is it possible at all?
You must define class wich conaining DB connection resource.
And add methods
function __sleep() {
$this->db->desconnect()
}
and
function __wakeup() {
$this->db = DB::Connect($this->dns);
}
method __wakeup() will be called when object restore from session.
method __sleep() will be called when object save to session.
May be this solve your problem.
--
Best regards, KVN.
PHP4You (<http://php4you.kiev.ua/>)
PEAR [ru] (<http://pear.php.net/manual/ru/>)
mailto:kvn@php.net