|
Joined: May 2003
Posts: 94
Power User
|
Power User
Joined: May 2003
Posts: 94 |
Is there a command that would show me how many/which users have logged into the forum in a perscribed amount of time? I'd like to see how many 'unique' users visit us daily.
|
|
|
|
Joined: Aug 2000
Posts: 1,609
Addict
|
Addict
Joined: Aug 2000
Posts: 1,609 |
This will show how many users have logged-in in the past day: <br />SELECT count(*) <br />FROM w3t_Users <br />WHERE ( UNIX_TIMESTAMP() - U_Laston ) / ( 3600 * 24 ) <= '1' <br /> If you want to see information about who they were, you could do something like: <br />SELECT U_Username <br />FROM w3t_Users <br />WHERE ( UNIX_TIMESTAMP() - U_Laston ) / ( 3600 * 24 ) <= '1' <br />
|
|
|
|
Joined: May 2003
Posts: 94
Power User
|
Power User
Joined: May 2003
Posts: 94 |
|
|
|
|
Joined: Aug 2000
Posts: 1,609
Addict
|
Addict
Joined: Aug 2000
Posts: 1,609 |
Go me! Go me! 
|
|
|
|
Joined: May 2003
Posts: 94
Power User
|
Power User
Joined: May 2003
Posts: 94 |
Hmm ok upon further inspection, it seems to show users who've logged in during the last like 24 days, not 24 hours  Still good though! But I'd like to see how many in 24 hours 
|
|
|
|
Joined: May 2001
Posts: 550
Code Monkey
|
Code Monkey
Joined: May 2001
Posts: 550 |
SELECT U_Username FROM `w3t_Users` WHERE `U_Laston` > (UNIX_TIMESTAMP( NOW() ) - 24 * 60 * 60)
|
|
|
|
Joined: Aug 2000
Posts: 1,609
Addict
|
Addict
Joined: Aug 2000
Posts: 1,609 |
Returns the same thing, as both queries correctly pull the number of users that have logged-in in the past 24 hour - not days. (UNIX_TIMESTAMP() - U_Laston ) / ( 3600 * 24 ) <= '1' (Now - LastOn) = Seconds ago LastOn Divide by (3600 * 24) (which is 86,400) since there are 3600 seconds in an hour, and 24 hours in 1 day. If they were on exactly 24 hours ago (86,400 seconds) then the equation would thus simplify to 86,400/86,400 which equals "1" for 1 day. Believe me - I use this equation for many features on my site, including "ranks" for users showing how long they've been registered, and I have yet to experience anything incorrect.
|
|
|
|
Joined: May 2003
Posts: 94
Power User
|
Power User
Joined: May 2003
Posts: 94 |
Ok, I understand your break down, however, that search returns 408 users out of 777. On close inspection of some of the names, I looked at 2, their 'last on' which resolves to April 14th and 18th. We're running 6.5.1.1 and who knows the issues which are wrong, but honestly, the result don't show just 24 hours 
|
|
|
|
Joined: Mar 2003
Posts: 159
Member
|
Member
Joined: Mar 2003
Posts: 159 |
OK, since we're on the subject, what would the query be to display those users that have not at least logged on the site within the last 6 month?
|
|
|
|
Joined: Aug 2000
Posts: 1,609
Addict
|
Addict
Joined: Aug 2000
Posts: 1,609 |
<br />SELECT U_Username<br />FROM w3t_Users<br />WHERE ( UNIX_TIMESTAMP() - U_Laston ) / ( 3600 * 24 ) >= '183'<br />
|
|
|
|
Joined: Mar 2003
Posts: 159
Member
|
Member
Joined: Mar 2003
Posts: 159 |
[] DLWebmaestro said:<br />SELECT U_Username<br />FROM w3t_Users<br />WHERE ( UNIX_TIMESTAMP() - U_Laston ) / ( 3600 * 24 ) >= '183'<br /> [/] SQL Error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(UNIX_TIMESTAMP() - U_Laston ) / ( 3600 * 24 ) > = '183'' at li SQL Error #: 1064 Query: SELECT U_UsernameFROM w3t_UsersWHERE (UNIX_TIMESTAMP() - U_Laston ) / ( 3600 * 24 ) > = '183'
|
|
|
|
Joined: Aug 2000
Posts: 1,609
Addict
|
Addict
Joined: Aug 2000
Posts: 1,609 |
Well that's what happens when you omit those spaces. 
|
|
|
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
|
|
Posts: 417
Joined: November 2001
|
|
Forums63
Topics37,575
Posts293,930
Members13,823
|
Most Online6,139 Sep 21st, 2024
|
|
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
|
|
|
|