Hi,
I've been searching now for the better part of the weekend but I can't get this to work :-/
I want to use Highcharts pie chart to display data from my mysql table.
I want to count the column 'Types' occurences of the different Types in that column. Each field contains only one word.
The expected output is :['Safari', 8.5], ['Opera', 6.2], ['Others', 0.7]
etc
The closest iv'e come is by doing this:
$result = mysql_query("SELECT Types FROM MCI ".$whereclause." ORDER BY ISF ASC");
if ($fresult) {
$kanalfordelning = array();
while ($row = mysql_fetch_array($fresult)) {
$Types[] = $row["Types"];
}
}
<?php $testisar = array_count_values($kanalfordelning); $festis = json_encode($testisar);?></p>
<?php echo $festis; ?>
Which outputs {"aDR":8,"SMS":2,"eDR":2}
So it's close but Highgraph needs brackets and not curly braces.
Any help would be appreciated!
/Adam