I have a mysql database that I store visitors in.
id ip date
-- ----------- ------------------
1 192.168.0.1 2013-02-08 12:12:04
2 192.168.0.1 2013-02-08 14:30:00
3 192.168.0.1 2013-02-09 16:43:46
4 192.168.0.1 2013-02-10 08:35:02
This a simplified version of that i am using but the concept is the same. I want to be able to get the number of visitors and display them in a chart by time interval. I use the following array design to populate the chart, where 0,1,2,3 is the x axis and 24, 74, 26, 51 is the y axis.
[[0, 24], [1, 74], [2, 26], [3, 52]]
I have tried to use the queries from stack question like this for instance but i cant get it to work with the Group by and that. Any help will be appreciated.
$query = "SELECT COUNT(id) FROM `unique_visitors_user` WHERE DATE(date) BETWEEN '2013-02-08' AND '2013-02-10' ";