I'm trying to make a pie chart to display data of operating systems, and am counting the operating system of each individual client with the following SQL query
SELECT os, COUNT( * ) AS count FROM clients GROUP BY os
I then put them inside an array with the following PHP
$query->execute();
$count = array();
while($row = $query->fetch()){
$currOS = $row['os'];
$count[$currOS] = $row['count'];
}
return json_encode($count);
This outputs the following when json_encode'd:
{"AAA":"1","Windows 7 x86":"12"}
However, the pie chart javascript plugin requires the following markup
var data = [
{ label: "AAA", data: 50},
{ label: "Windews 7", data: 7},
{ label: "Windews XP", data: 8},
{ label: "Windows 8", data: 9}
];
What would be the correct PHP syntax for me to use?