Statistical data handling in php

From: Date: Tue, 25 Jul 2000 13:56:57 +0000
Subject: Statistical data handling in php
Groups: php.general 
Request: Send a blank email to php-general+get-8025@lists.php.net to get a copy of this message
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); }

« previous php.general (#8025) next »