[thelist] Statistical data handling in php

Webmaster webmaster at redhotsweeps.com
Mon Jul 24 18:53:17 CDT 2000


Does anyone here do any statistical data handling in php?  ie....finding 
average number of user by the hour, day, week, month, year?  How do you do 
the date ranges?  I am just getting into the week sections and the only way 
I can figure it out is to use 7 if statements for each week. (see 
below)  It makes for some REALLY ugly code.   Any pointers?

Thanks

CDitty

ps....thanks Rudy.  That SQL statement did the trick.  Had to rewrite the 
rest of it, but it handled the data where mine crashed.

// This Week
$todayWord = date("D");
if($todayWord == "Sun"){
	$thisWeekHigh  = $today - ($oneDay * 0);
	$thisWeekHigh  = date("mdy", $thisWeekHigh);
	$thisWeekLow  = $today - ($oneDay * 0);
	$thisWeekLow  = date("mdy", $thisWeekLow);
}
$todayWord = date("D");
if($todayWord == "Mon"){
	$thisWeekHigh = $today - ($oneDay * 0);
	$thisWeekHigh = date("mdy", $thisWeekHigh);
	$thisWeekLow  = $today - ($oneDay * 1);
	$thisWeekLow  = date("mdy", $thisWeekLow);
}
$todayWord = date("D");
if($todayWord == "Tue"){
	$thisWeekHigh  = $today - ($oneDay * 0);
	$thisWeekHigh  = date("mdy", $thisWeekHigh);
	$thisWeekLow  = $today - ($oneDay * 2);
	$thisWeekLow  = date("mdy", $thisWeekLow);
}
$todayWord = date("D");
if($todayWord == "Wed"){
	$thisWeekHigh  = $today - ($oneDay * 0);
	$thisWeekHigh  = date("mdy", $thisWeekHigh);
	$thisWeekLow  = $today - ($oneDay * 3);
	$thisWeekLow  = date("mdy", $thisWeekLow);
}
$todayWord = date("D");
if($todayWord == "Thu"){
	$thisWeekHigh  = $today - ($oneDay * 0);
	$thisWeekHigh  = date("mdy", $thisWeekHigh);
	$thisWeekLow  = $today - ($oneDay * 4);
	$thisWeekLow  = date("mdy", $thisWeekLow);
}
$todayWord = date("D");
if($todayWord == "Fri"){
	$thisWeekHigh  = $today - ($oneDay * 0);
	$thisWeekHigh  = date("mdy", $thisWeekHigh);
	$thisWeekLow  = $today - ($oneDay * 5);
	$thisWeekLow  = date("mdy", $thisWeekLow);
}
$todayWord = date("D");
if($todayWord == "Sat"){
	$thisWeekHigh  = $today - ($oneDay * 0);
	$thisWeekHigh  = date("mdy", $thisWeekHigh);
	$thisWeekLow  = $today - ($oneDay * 6);
	$thisWeekLow  = date("mdy", $thisWeekLow);
}


--------------------------------------------------------------------
Follow our links to the end of the rainbow where you'll find your pot of gold.
http://www.redhotsweeps.com





More information about the thelist mailing list