/    Sign up×
Community /Pin to ProfileBookmark

Advanced Website Statistics

i have been working on a advanced website stats page ([URL=http://www.shogans.com/stats/shogansstats.php]Here[/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 ? )

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 [url]http://www.shogans.com/stats/shogansstats.php[/url]

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@russellDec 02.2006 — not sure i follow the question, but u do have a php error on the page. anyway, if i DO follow the question, here it is...

[u]page views[/u]

select count(id) from yourTable

[u]unique hits[/u]

select count(distinct ip) from yourTable

need to do a little date math to get this week results. see sql datepart() function
Copy linkTweet thisAlerts:
@PezmcauthorDec 02.2006 — Thanks yeh I am trying to get

[b]Records[/b]

Most pagevies on a day

Most unique hits on a day

[B]Pageviews[/B]

Pageviews this month

Pageviews this week

[B]Unique hits[/B]

Unuike hits this month

Unuikue hits this week
Copy linkTweet thisAlerts:
@russellDec 02.2006 — what dbms are u using?
Copy linkTweet thisAlerts:
@PezmcauthorDec 02.2006 — I use mysql
Copy linkTweet thisAlerts:
@mrblackDec 02.2006 — Your page is currently giving this error: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/www/shogans.com/stats/shogansstats.php on line 123
×

Success!

Help @Pezmc spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...