I have php code that I'm using along with sql to get results from a DB base on EA number and ID number to graph them.
<?php
$sql=
("SELECT D as y,Total as a,PoweredOn as b
FROM MasterUsageTable
WHERE ID IN
(SELECT ID FROM MasterUsageTable
WHERE EA_Number = '$valueEA' AND D BETWEEN #$valueSDate# AND #$valueEDate#)");
$rs = odbc_exec($con, $sqlVMs);
if (!$rs) {
exit("Enter EA!");
}
$data = array();
while ($row = odbc_fetch_array($rs)){
$data[] = $row;
}
echo json_encode($data);
?>
At the moment the way I'm getting my results after the json encode is like this:
[{"y":"2015-03-26","a":"16","b":"14"},{"y":"2015-03-26 ","a":"59","b":"12"},{"y":"2015-03-26 ","a":"21","b":"5"},{"y":"2015-03-26 ","a":"35","b":"12"},{"y":"2015-03-26 ","a":"17","b":"2"}]
I was hoping there was some way of separating them like so:
[{"y":"2015-03-26","a":"16","b":"14"},{"y":"2015-03-26 ","a":"59","b":"12"},{"y":"2015-03-26 ","a":"21","b":"5"}],[{"y":"2015-03-26 ","a":"35","b":"12"},{"y":"2015-03-26 ","a":"17","b":"2"}]
So that it’s multiple arrays of data based on which ID it is. Hope that makes sense, thanks