Querying a mysql database for the last week of data
Posted: Fri Oct 19, 2007 7:14 am
Hi, I am currently working on a advanced hit counter for mysql query practice and have hit a wall. How can I query for data in the past week? By that I mean monday-sunday not the past seven days.
In my database I have stored
Ip - 80.168.0.3
Date - 2007/10/19
Time - 12:35:57
I am trying to perform a query similar to this to return unique hits during this week
How can I achieve this?
In my database I have stored
Ip - 80.168.0.3
Date - 2007/10/19
Time - 12:35:57
I am trying to perform a query similar to this to return unique hits during this week
Code: Select all
// How many unique hits today
$result = mysql_query ("SELECT DISTINCT(ip) FROM stats WHERE date='$serverdate' ORDER BY ip");
$uniquehitstoday = mysql_num_rows($result);