By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,664 Members | 1,623 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,664 IT Pros & Developers. It's quick & easy.

Looping through session data

P: n/a
Hi all,

I'm using a database session handler and am looking to loop through
data residing in the sessions table to make a 'Users online' array.

I've found that using urldecode on the data column gives me a
serialized string of varname|datatype:data; for each variable. I'm
having a bit of trouble with deserializing the data.

I could always use regexps to grab the specific data I want, but I'm
sure there's a better way to do this. Any help is greatly appreciated.

Thanks much!
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
ensnare wrote:
Hi all,

Iím using a database session handler and am looking to loop through
data residing in the sessions table to make a íUsers onlineí array.

Iíve found that using urldecode on the data column gives me a
serialized string of varname|datatype:data; for each variable. Iím
having a bit of trouble with deserializing the data.

I could always use regexps to grab the specific data I want, but Iím sure thereís a better way to do this. Any help is greatly appreciated.
Thanks much!

PHP has a nice way of looping thru variables inside an array so with
query string you can do something like this:

foreach ($GET as $key => $value) {
//not do something with $value[$key]...
}

same for cookies, $_PUT, $_SERVER, etc.

--
http://www.dbForumz.com/ This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/PHP-Looping-...ict124156.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=413682
Jul 17 '05 #2

P: n/a
Hi ensnare,

On 28 Jun 2004 18:11:04 -0700, en*****@gmail.com (ensnare) wrote:
Hi all,

I'm using a database session handler and am looking to loop through
data residing in the sessions table to make a 'Users online' array.

I've found that using urldecode on the data column gives me a
serialized string of varname|datatype:data; for each variable. I'm
having a bit of trouble with deserializing the data.


Have you tried unserialize()?

HTh, Jochen
--
Jochen Daum - Cabletalk Group Ltd.
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.