Re: code example to store PHP session data in mySQL ?
| From: | Torsten Roehr | Date: | Tue, 12 Oct 2004 16:17:21 +0000 |
| Subject: | Re: code example to store PHP session data in mySQL ? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-36854@lists.php.net to get a copy of this message | ||
"Kalle" <karl-thomas.schmidt@web.de> wrote in message
news:20041006185449.8428.qmail@pb1.pair.com...
> Hi @ all,
>
> where can I find a working example that shows me how to implement
PHPSESSION
> with MySQL as stor?
>
> tia
Hi,
I'm using PEAR's HTTP_Session in combination with PEAR::DB:
http://pear.php.net/package/DB
http://pear.php.net/package/HTTP_Session
Just set those two packages up, create a session table (see
HTTP_Session/Container/DB.php for the schema) and set this HTTP_Session
option:
HTTP_Session::setContainer('DB', array('dsn' => $dsn, 'table' =>
'sessions',
'autooptimize' => true));
...and off you go.
Regards, Torsten Roehr