Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I want a USERS ONLINE script. It shows how many people are online within the past 5 minutes. It also shows how many uniques were shown 24 hours ago (not every day, but 24 hours ago from whatever time it is).
The users online part works but the 24 hour users don't seem to be resetting. Everyday the number grows and grows and grows. So is my logic messed up for clearing all data from over 24 hours ago?
my $timenow = time(); $minutes = $minutes * 60; my $timemin = $timenow - $minutes; my $data = qq(DELETE FROM now_time WHERE lasttime < "$timemin"); my $sth = $dbh->prepare($data); $sth->execute() or die $dbh->errstr; my $day = 60 * 60 * 24; my $timeday = $timenow - $day; my $data = qq(DELETE FROM day_time WHERE lasttime < "$timeday"); my $sth = $dbh->prepare($data); $sth->execute() or die $dbh->errstr;
2005-09-14 Retitled by g0n, as per Monastery guidelines
Original title: 'Removing something from MySQL table based on time'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (OT) Removing something from MySQL table based on time
by pg (Canon) on Sep 09, 2005 at 00:41 UTC | |
|
Re: (OT) Removing something from MySQL table based on time
by McDarren (Abbot) on Sep 09, 2005 at 02:11 UTC | |
|
Re: (OT) Removing something from MySQL table based on time
by bradcathey (Prior) on Sep 08, 2005 at 23:24 UTC | |
by Anonymous Monk on Sep 08, 2005 at 23:34 UTC |