1.

Is There A Way To Get/convert The Resultset In Exactly The Same Format As Is Required By The Series Property Of Highcharts?

Answer»

Not got a chance to run the code below, but this should work or something very similar to this

$series=array();
while($item = mysql_fetch_assoc($result)) {
$serie=array(
"NAME" => $item['name'],
"data" => array(floatval($item['data']))
);
array_push($series,$serie);
}
echo json_encode($series);

An advice is to always STICK to json_encode() for doing the jsonification. You may want to go through this EXAMPLE on the reference page to learn about how json_encode works with arrays in PARTICULAR

Not got a chance to run the code below, but this should work or something very similar to this

$series=array();
while($item = mysql_fetch_assoc($result)) {
$serie=array(
"name" => $item['name'],
"data" => array(floatval($item['data']))
);
array_push($series,$serie);
}
echo json_encode($series);

An advice is to always stick to json_encode() for doing the jsonification. You may want to go through this example on the reference page to learn about how json_encode works with arrays in particular



Discussion

No Comment Found