Users online from several tables
Date: 10/24/05
(PHP Community) Keywords: php
Hello,
I've written users online display scripts before, but in all of those cases I have worked with one table, and all the information was garnered from one page.
I now want to be able to take information from several tables, and add them together to display the total # of users online for the entire portion of the site.
A little more background : There are several chatrooms (php based) which each display their unique # of users in a list.
So say, for example, there are these rooms, and in parenthesis is displayed the total amount of people in each room:
Lobby (24)
Women (1)
Men (5)
Hobbiests (7)
This is all displayed on a seperate page, say roomchoice.php. Now, before you get to roomchoice.php, there is another page, signup.php. And on signup I want to display the total number of all users in the chat, possibly by adding together the # of users on line for each room. (ie : $totalusers = $lobbyusers + $womenusers + $menusers + $hobbiestusers; (using whatever the preexisting variable for displaying the # of users online from roomchoice.php)).
Now, I didn't write the chat program, or the existing user online portions of the site, and haven't yet recieved the code I will be working with, but assuming it is done similiary to the ways I have worked with users online before -- would each chatroom have it's own table to collect the online user's information (time, ip, etc) . . . and if so, would it be easier for me to somehow pull the variable information that is displayed on roomchoice.php, and just add it like i have above and display it on the signup.php page? Ad to that would I just simply use include to pull that variable information from roomchoice.php?
I know it's hard for me to ask this, because I don't know how it is set up yet, - but what are the other possible ways that I can retrieve this information without having to rewrite the entire SELECT queries for each room on signup.php.
Thank you for any help, I hope I have provided enough information, and stated my problem/question clearly.
Source: http://www.livejournal.com/community/php/357239.html