Hi,

Our Radius server reports a users usage as the following ->

ACCTSTATUSTYPE          TIME_STAMP
        1                       991200195
        2                       991200243
Where ACCTSTATUSTYPE == 1 is starttime and ACCTSTATUSTYPE == 2 is the stop
time

Which with perl, I can use the localtime function to convert 991200243 to
Wed May 30 15:24:03 2001.

What I wanted to be able to do is convert to date on the fly in my mysql
statement, so a user could go to a webpage, enter there username/password
date (eg. 'May') and year (eg. 2001).

Something along the lines of ->

$month = 'May'
$year = '2001'

Obviously the following is incorrect with respect to the month+year
statement  ;)

my $sth = $dbh->prepare("SELECT RADUSAGE.USERNAME,COUNT(*) as number,
sum(RADUSAGE.ACCTSESSIONTIME) as ACCTSESSIONTIME,
sum(RADUSAGE.ACCTOUTPUTOCTETS)/1048576 as ACCTOUTPUTOCTETS FROM RADUSAGE
WHERE RADUSAGE.USERNAME = '$user_name' and month(TIME_STAMP) = '$month' AND
year(TIME_STAMP) = '$year' GROUP BY RADUSAGE.USERNAME") or die "Couldn't
prepare statement: " . $dbh->errstr;


Hope someone can help.

Regards,
Michael



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to