php separate
This commit is contained in:
20
php/warntrack.php
Normal file
20
php/warntrack.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/common.php';
|
||||
|
||||
$dbconn = getDBConnection();
|
||||
|
||||
//no gets, curent point outage info
|
||||
if(empty(array_diff_key($_GET, array('service' => '')))) {
|
||||
$result = pg_query($dbconn,
|
||||
"SELECT json_build_object('type', 'FeatureCollection','features', json_agg(json_build_object('type','Feature', 'geometry', ST_AsGeoJSON(nwspoly)::json,'properties',json_build_object('issue',issue,'endtime',endtime,'warntype',warntype,'etin',etin,'followups',followups,'followup',followup,'canexp',canexp,'warnexpired',warnexpired,'vtectext',vtectext,'office',office))order by issue desc)) FROM warntracker WHERE office = 'KRLX' and svstype = 'NEW' and EXTRACT(EPOCH FROM (current_timestamp - endtime ))/60 < 2400") or die('Query failed: ' . pg_last_error());
|
||||
$resultArray = pg_fetch_all($result);
|
||||
echo($resultArray[0]['json_build_object']);
|
||||
}
|
||||
|
||||
pg_free_result($result);
|
||||
|
||||
// Close database connection when needed
|
||||
if (isset($dbconn)) {
|
||||
pg_close($dbconn);
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user