__init__($conn);
// Obtain all data records from the database table and print them as table rows.
$date=[]; $no2=[]; $o3=[]; $temp=[]; $humd=[]; $wind=[]; $img=[]; $m_result=[];
list($date, $no2, $o3, $temp, $humd, $wind, $img, $m_result) = $air->get_data_records();
$records = "
Date
NO2
O3
Temperature
Humidity
Wind Speed
Model Prediction
IMG
";
for($i=0; $i
'.$date[$i].'
'.$no2[$i].'
'.$o3[$i].'
'.$temp[$i].'
'.$humd[$i].'
'.$wind[$i].'
'.$m_result[$i].'
';
}
// Get the latest surveillance image from the database table.
$latest_img = $img[0];
// Create a JSON object from the generated table rows and the latest surveillance image.
$result = array("records" => $records, "latest_img" => "env_notifications/images/".$latest_img);
$res = json_encode($result);
// Return the recently generated JSON object.
echo($res);
?>