Jump to content

[SOLVED] Advanced Website Statistics


Pezmc

Recommended Posts

i have been working on a advanced website stats page ([url=http://www.shogans.com/stats/shogansstats.php]http://www.shogans.com/stats/shogansstats.php[/url]), however when it has got to the more advanced mysql queries i am stumped.

Here is my database structure
[code]id    browser    ip    recieved    refer    user
1 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv... 87.113.14.221 2006-11-29 http://www.shogans.com/index.php?do=fight
2 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv... 87.113.14.222 2006-11-30 http://www.shogans.com/index.php
3 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv... 87.113.14.223 2006-11-30 http://www.shogans.com/index.php
4 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv... 87.113.14.224 2006-11-30 http://www.google.co.uk/search?hl=en&safe=off&clie...
5 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv... 87.113.14.224 2006-12-01 http://www.shogans.com/index.php
6 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv... 87.113.14.224 2006-12-01 http://www.shogans.com/index.php
7 Mozilla/4.5 (compatible; HTTrack 3.0x; Windows 98) 193.205.147.22 2006-12-01 None
8 Mozilla/4.5 (compatible; HTTrack 3.0x; Windows 98) 193.205.147.22 2006-12-01 None
9 Mozilla/4.5 (compatible; HTTrack 3.0x; Windows 98) 193.205.147.22 2006-12-01 None
10 Mozilla/4.5 (compatible; HTTrack 3.0x; Windows 98) 193.205.147.22 2006-12-01 None
11 Mozilla/4.5 (compatible; HTTrack 3.0x; Windows 98) 193.205.147.22 2006-12-01 None
12 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv... 87.113.14.225 2006-12-01 http://www.shogans.com/index.php
13 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv... 87.113.14.228 2006-12-01 http://www.shogans.com/index.php
14 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv... 87.113.14.229 2006-12-01 http://www.shogans.com/index.php
15 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv... 87.113.14.230 2006-12-01 http://www.shogans.com/index.php
16   209.172.38.156 2006-12-01 None
17 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv... 87.113.14.220 2006-12-01 None
18 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1;... 87.113.14.220 2006-12-01 None
19 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1;... 87.113.14.220 2006-12-01 http://www.google.co.uk/ig
20 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv... 87.113.14.220 2006-12-01 None [/code]

Now I am trying to work out these things from that database. Anyone that helps me will get a link to their site on the thanks page (I'm a nice guy  ;D)

The things I dont understand how to get from that are:
Record
Unique Hits: Would like a result like 19 - 01 October 2006
Page Views: Would like a result like 19 - 01 October 2006
as well as
Unque hits
This Week: 85
This Month: 264
and
Pageviews
This Week: Would like a result like 85
This Month: Would like a result like 264

Please help me get these results I have allready got by myself everything at http://www.shogans.com/stats/shogansstats.php
Link to comment
https://forums.phpfreaks.com/topic/29157-solved-advanced-website-statistics/
Share on other sites

I don't see the name of your date/time field. If it is all part of your "user" field, you'll need to break that apart first.
Something like this should work:
[code]
SELECT DATE(name_of_timestamp) AS the_day, COUNT(DISTINCT(user)) AS num_users
FROM table
GROUP BY DATE(name_of_timestamp)
[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.