Do you have a question? Post it now! No Registration Necessary. Now with pictures!
September 7, 2005, 10:02 pm
rate this thread
PHP and MySql
Thanks to everyone for help on questions I've posted here. Here's
Imagine I have a table containing details of pageviews on a website. To
keep the example simple this table has a colum called 'Date' and imagine
that the earliest date in there is 01/01/04 (01 Jan 04) and each
individual page view has a row.
Can anyone point me in the direction how I could report on this data so
that for example I could display on screen -
Views This Week
Views This Year
Views Last Year etc etc
Re: Analyzing dates in a table
Aside from that, it isn't too tough:
where Date = curdate()
Hits this week:
where weekofyear(Date) = weekofyear(curdate())
and year(Date) = year(curdate())
If you want to count total hits for some arbitrary interval:
where Date between '1/5/2005' and '7/16/2005'
And, if you want to see these broken out by each page, just add
'pageename' to the select list and add a 'group by pagename' at the end
of the query.