You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

26 lines
865 B

<?php
error_reporting(0);
include '../DB.php';
try {
$conn=new DB();
if($conn){
$facilityno=$_REQUEST['facilityno'];
$sql="SELECT * from facility_breakdown where facilityno='$facilityno'";
$result=$conn->getAll($sql);
$tongji="SELECT COUNT(facilityno) AS ucnt, breakdown_date AS view_day FROM facility_breakdown where facilityno='$facilityno' GROUP BY breakdown_date ";
$tongjiresult=$conn->getAll($tongji);
for($i=0;$i<sizeof($tongjiresult);$i++){
$tongjiresult[$i]['view_day']=date('m/d',strtotime($tongjiresult[$i]['view_day']));
}
$res['tables']=$result;
$res['labels']=array_column($tongjiresult,'view_day');
$res['data']=array_column($tongjiresult,'ucnt');
echo json_encode($res);
}
}catch (Exception $e) {
die($e->getMessage());
}
?>