Highstock mysql json compare multiple series -
please create query! working example of query retrieve data json using php:
<?php $con = mysql_connect("localhost","user","password"); if (!$con) { die('could not connect: ' . mysql_error()); } mysql_select_db("admin_accounting", $con); $result = mysql_query("select unix_timestamp(date), sum(ksi2k) accounting lhc_vo 'ops' group year(date), month(date)"); $rows = array(); $rows['type'] = 'area'; $rows['name'] = 'ops'; while($r = mysql_fetch_array($result)) { $rows['data'][] = $r[0]*1000; $rows['data'][] = $r[1]; array_push($rows); } print json_encode($rows, json_numeric_check); mysql_close($con); ?>
the json results this:
{"type":"area","name":"ops","data":[1167664515000,0,1170342915000,0,1172762115000,0,1175436915000,0,1178028915000,0]}
but need json results should this:
{"type":"area","name":"ops","data":[[1167664515000,0],[1170342915000,0],[1172762115000,0],[1175436915000,0],[1178028915000,0]]}
i grateful help
while($r = mysql_fetch_array($result)) { $rows['data'][] = array($r[0]*1000, $r[1]); }
Comments
Post a Comment