#native_company# #native_desc#
#native_cta#

Revisited: Logging With PHP Page 3

By Tim Perdue
on December 10, 2000

REPORTING
Reporting all this information is easy with PHP – just write up some SQL,
execute it and use the ShowResults() function (included below) to display it.
You can also graph it using the Graphing Lib that I mentioned in
a prior article.
So now the system is in place and I can run a report at any time
and get statistics up to the minute for any given site.

Sample SQL to run reports

Page Views By Day
SELECT day, count(*) 
FROM activity_log 
WHERE type=0 GROUP BY day
Page Views By Browser
SELECT browser, count(*) 
FROM activity_log  
WHERE type=0 GROUP BY browser
Page Views By Browser Version
SELECT browser, ver, count(*)
FROM activity_log
WHERE type=0 GROUP BY browser, ver
Page Views By Platform
SELECT platform, count(*)
FROM activity_log
WHERE type=0 GROUP BY platform
Overall, I’m pretty impressed with this system. There’s really no limit to its
flexibility.
Please use the sample code on the next page and tell me how you
used it, or if you added anything interesting to it.