473,378 Members | 1,354 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Looping through session data

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
2 3966
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: kaptain kernel | last post by:
i've got a while loop thats iterating through a text file and pumping the contents into a database. the file is quite large (over 150mb). the looping causes my CPU load to race up to 100 per...
4
by: Colin Steadman | last post by:
I've create a simple survey using ASP. Its finished and works, but one aspect of my coding is annoying me and I cant figure out a better way of doing it. Basically the questions are stored in...
1
by: Nicole | last post by:
Hello! I hope there is someone out there who can shed some light on this for me. I have a module that is supposed to look at an access table, pull out each bid record, link to another table to...
7
by: Brian Conway | last post by:
Can anyone give me an example of how I can loop through a datagrid and have it run a stored procedure each time it loops?
5
by: Abhilash.k.m | last post by:
This is regarding the session management using Out of proc session management(SQL SERVER). Among the samples below which one is better to set the session? 1. There are 20 session...
13
by: JayCallas | last post by:
I know this question has been asked. And the usual answer is don't use cursors or any other looping method. Instead, try to find a solution that uses set-based queries. But this brings up...
8
by: Steve Le Monnier | last post by:
Can anybody help with the following: I have some old VB6 code that loops through my inbox looking for emails with attachments and then save them to the hard drive. The code is very simplistic so I...
5
by: worldspy | last post by:
Hi guys, I don't know whether this is feasible or not. But here is my problem I have a session variable which has database field names in a particular order and this variable is generated...
2
nine72
by: nine72 | last post by:
Hi, first I want to say thanks for the help I received here over a year ago with a perplexing issue that I had. The advise was fantastic and helped a lot. Today I have another issues that I can...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.