PDA

View Full Version : Calculating averages problem


Boofo
05-31-2010, 05:56 PM
I have run into a wall here. I am trying to calculate the averages for site visits. I have done it exactly like the average threads and posts but for some reason it is way off. Here is what I am using:

$pagehits_counter = $vbulletin->boofocounter;
$starttime = (TIMENOW - $vbulletin->options['site_lifestatus_startupdate']);

$starthour = $starttime / 3600;
$pagehits_hourly = vb_number_format($pagehits_counter / $starthour, 2);

$startday = $starttime / 86400;
$pagehits_daily = vb_number_format($pagehits_counter / $startday, 2);


The hourly pagehits should be around 48.?? but it is showing up as 0.05. Can anyone spot what I am doing wrong or what is missing?

--------------- Added 1275380790 at 1275380790 ---------------

I figured out what I was doing wrong. I forgot to add strtotime to the code. All is working now. I must be losing it in my old age to overlook something so simple. I'm ready to be punished now. :(