Organizeing results from database
Moderator: General Moderators
Organizeing results from database
I have a stat system I'm writeing for my website... how would i go about takeing what i have so far (a table filled with my entire log: ip, refferer, etc...) and putting it into like a stats page (xx% of people use internet explorer, XX% of ppl referred from http://www.somesite.com) keep in mind i already have all the stuff in the database and can retreive it... just need help organizeing it.
-
kettle_drum
- DevNet Resident
- Posts: 1150
- Joined: Sun Jul 20, 2003 9:25 pm
- Location: West Yorkshire, England
You just need to decide what you want to show and then create queries to retreive that data.
Number of unique IP's : SELECT count(DISTINCT ip) FROM stats
Total number of hits: SELECT count(*) FROM stats
Number of hits in last hour: SELECT count(*) FROM stats WHERE time > time()-3600
ect.
Then just print the result out in nice tables or however you wish to show it.
Number of unique IP's : SELECT count(DISTINCT ip) FROM stats
Total number of hits: SELECT count(*) FROM stats
Number of hits in last hour: SELECT count(*) FROM stats WHERE time > time()-3600
ect.
Then just print the result out in nice tables or however you wish to show it.
Thanks, this helps alot to get me started... I coded almost everything except I am stuck on one thing:
How would I check what the most popular item is, for instance:
all my pages are the same page (index.php?page=XXXXXXX)
like that, everytime the page loads it stores the value of $page into the database as column querry... how would i show a list of the top 10 querries?
How would I check what the most popular item is, for instance:
all my pages are the same page (index.php?page=XXXXXXX)
like that, everytime the page loads it stores the value of $page into the database as column querry... how would i show a list of the top 10 querries?