We are stuck performing this mySQL query and the PHP along side it.
Here is our query:
SELECT DATE(`Checked`) AS theday, COUNT(`Download ID`) AS thecount,
`Status` AS thestatus
FROM `download`
WHERE `Checked`>= (CURRENT_DATE - INTERVAL 14 DAY)
GROUP BY theday, thestatus ORDER by theday DESC
Here is the PHP:
while ($r = mysql_fetch_array($q)){
echo "<pre>";
print_r($r);
echo "</pre>";
}
Here is a sample output:
Array
(
[0] => 2011-10-10
[theday] => 2011-10-10
[1] => 1
[thecount] => 1
[2] => Downloading
[thestatus] => Downloading
)
Array
(
[0] => 2011-10-10
[theday] => 2011-10-10
[1] => 9
[thecount] => 9
[2] => Converting
[thestatus] => Converting
)
Array
(
[0] => 2011-10-10
[theday] => 2011-10-10
[1] => 2673
[thecount] => 2673
[2] => Complete
[thestatus] => Complete
)
Array
(
[0] => 2011-10-10
[theday] => 2011-10-10
[1] => 366
[thecount] => 366
[2] => Aborted
[thestatus] => Aborted
)
Basically, we want to display the results like this, in a while loop, for each day:
2011-10-10
Downloading: 1
Converting: 9
Complete: 2673
Aborted: 366
Error: 0
We are stuck on how to do the query & the PHP to get the results displayed like this.
We basically want the above example, to be looped 14 times (for the last 14 days), and output like the above example, so it groups the count & status for each day and echos it out like so.
Thank you.
You would need to build an array of date to status data. For example
and to display…