I am currently working on a web application and using ChartJS. I need to get data from the last 7 days and count it. I explain:
I need to count the number of client that registered each days from the seven last days to display it with ChartJS.
I have some problems with the SQL Request.
Get today's date:
$jj = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d"), date("Y")));
In my database, i have a 'created_at' column with timestamp like this :
2018-08-21 11:07:59
For the request, I followed some tutorials and did this:
SELECT count(client.id) FROM parcel WHERE created_at = :dateclient, array('dateclient' => $jj);
But the request isn't working, I assume that there are some errors. If some pros knows how to do it !
By the way: I did the request for one date for the moment, but I will need to do it for seven days