Page 1 of 1

Organizeing results from database

Posted: Sat May 22, 2004 10:17 pm
by josh
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.

Posted: Sun May 23, 2004 9:54 am
by kettle_drum
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.

Posted: Mon May 24, 2004 6:47 pm
by josh
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?