Re: Sessions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 15 Sep 2008, at 17:52, Jim Lucas wrote:
Stut wrote:
On 15 Sep 2008, at 16:20, Thodoris wrote:
Also just to throw this out, you can also use the
session_set_save_handler
function.  This will let you store your sessions wherever you see
fit.  file
system, database, etc.  Comes in handy when you're on multiple web
servers.

http://us2.php.net/session_set_save_handler


Living to learn every single day. Although I find this feature very
useful (storing session data in a database for e.g. mysql) I didn't
find any good example in the manual or anywhere near using it.

Can anyone enlighten me on this ?

http://stut.net/blog/2008/07/20/mysql-sessions/

-Stut


Stut,

I have a question about your Read() method.

You are initializing a variable called $retval, but then doing nothing with it.

Then you are returning the result handler whether is it a db handle or a result set. Also, you are running mysql_free_result on that result variable
before returning it.

Indeed, that was pretty messed up. That's what happens when you edit code in WordPress. Thanks for the heads up, I've updated the post.

Plus, what does the ampersand before the method name do for you?

It tells the function to return a reference. Session data can be pretty big so on older versions of PHP this can save a fair amount of memory. With CoW now in place in later versions it has no effect at all but I've left it it for compatibility.

-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux