<?php
include("WIP/dbconnect.php")
?>
</head>
<?php
$link = Connection();
$result=mysql_query("SELECT `testLocation`.`Date`,
`testLocation`.`Serial`, `testLocation`.`State`,
`testLocation`.`Count` FROM `testLocation`",$link);
if($result!==FALSE){
//create an array
$emparray = array();
while($row = mysql_fetch_array($result))
{
$emparray[] = $row;
}
echo json_encode($emparray);
mysql_free_result($result);
mysql_close();
}
?>
I am currently trying to convert some data from my mysql database into json format but for some reason the data being produced isn't in a good format. It looks like this Data Link
I got the JSON data to format correctly but I am unable to generate the graph. I am currently using AmCharts.com to generate the graph. It says Cannot Parse Json
<script>
var chart = AmCharts.makeChart( "chartdiv", {
"type": "serial",
"dataLoader": {
"url": "index2.php"
},
"pathToImages": "http://www.amcharts.com/lib/images/",
"categoryField": "Date",
"dataDateFormat": "YYYY-MM-DD 00:00:00",
"startDuration": 1,
"categoryAxis": {
"parseDates": true
},
"graphs": [ {
"valueField": "Serial",
"bullet": "round",
"bulletBorderColor": "#FFFFFF",
"bulletBorderThickness": 2,
"lineThickness ": 2,
"lineAlpha": 0.5
}, {
"valueField": "State",
"bullet": "round",
"bulletBorderColor": "#FFFFFF",
"bulletBorderThickness": 2,
"lineThickness ": 2,
"lineAlpha": 0.5
}, {
"valueField": "Count",
"bullet": "round",
"bulletBorderColor": "#FFFFFF",
"bulletBorderThickness": 2,
"lineThickness ": 2,
"lineAlpha": 0.5
}] } );