give me advice for scritps no run json..
this my Code PHP:
<?
$data_points = array();
$query = “SELECT id_unit, name_unit,
MAX(CASE WHEN STAT = ’employee’ THEN total ELSE NULL END) employee
,
MAX(CASE WHEN STAT = ‘Non_employee’ THEN total ELSE NULL END) Non_employe
FROM
(SELECT user.id_unit,
unit_work.name_unit,
status_peg.STAT,
COUNT(user.id_employe) total
FROM user
INNER JOIN unit_work ON user.id_unit = unit_work.id_unit
INNER JOIN stat ON user.id_stat = stat.id_stat
GROUP BY unit_work.name_unit, user.id_stat
order by user.id_unit_work, user.id_stat) aa
GROUP BY name_unit
order by id_unit_work”;
$result = mysql_query($query);
while($row = mysql_fetch_array($result)){
$point = array(“label” => $row[‘name_unit’] , “y” => $row[’employee’]);
array_push($data_points,$point );
}
?>
==========================
HTML:
<!DOCTYPE html>
<html xmlns=”http://www.w3.org/1999/xhtml” >
<head>
<title></title>
<script src=”jquery.js”></script>
<script src=”canvasjs.js”></script>
<script type=”text/javascript”>
window.onload = function () {
var chartemploye = new CanvasJS.Chart(“Container”, {
data: [
{
type: “bar”,
name: “employee”,
showInLegend: true,
dataPoints: [<?=$data_points;?>]
}
]
});
chartemploye.render();
}
</script>
</head>
<body>
<div id=”Container” style=”width: 100%; height: 380px;”></div>
</body>
</html>
Please given me advice.. thanks