I've looked at the other topics concerning passing JSON data to feed JQPlot but can't quite seem to find what I need. The issue is that I can't get the JSON data formatted correctly. (Yes, this is my first time with formatting and using JSON) I've tried all kinds of combinations, but I'm still looking for the right one.
JQPlot wants to see the data as
[[x,y],[x,y],[x,y],[x,y]]
but the best I've been able to output is
[x,y][x,y][x,y][x,y]
I'm hoping that someone might be able to tell me what I'm missing. My code is below...
$sql = "SELECT client_id, SUM(gross) FROM s_pr_wcomp GROUP BY client_id ORDER By SUM(gross) DESC LIMIT 10";
$result = mysqli_query($mysql,$sql) or die(mysqli_error('Top 10 Query Failed!'));
// Encode Top 10
while($row = mysqli_fetch_array($result)){
$grossTop = array(
$grossTop[] = $row['client_id'],
$grossTop[] = '$'.number_format($row['SUM(gross)'], 2)
);
header('ContentType: application/json; charset=utf-8');
echo json_encode($grossTop);
}
Thank you!