Making Usage Statistics in PHP - Showing Figures Based on the Statistics
(Page 4 of 7 )
In a lot of cases the text-based statistics with two tables are enough, but figures made from the database can be more useful. What kind of figures can we make? Some examples: the number of the visitors on the days of the week, the page impressions ordered by the hours of the day, and the number of the reads of the pages.
Here we will make a chart to show how many pages the visitors downloaded. First of all, let's do the query:
SELECT Host
, Count(ID) as Count_ID FROM hits
GROUP BY Host
ORDER BY Count_ID DESC
LIMIT 0, 10
Use the LIMIT clause on only the first ten rows of the query. We don't want to see thousands of users on a figure, only the Top 10. ORDER BY is necessary to see the "top 10" visitors who read the most from your site.
Next: Creating the Image Library >>
More PHP Articles
More By Adam Szanto