20 lines
946 B
PHP
20 lines
946 B
PHP
<?php
|
|
// Connecting, selecting database
|
|
$dbconn = pg_connect("host=localhost dbname=nws user=nws password=nws")
|
|
or die('Could not connect: ' . pg_last_error());
|
|
|
|
//no gets, curent point outage info
|
|
if(empty($_GET)) {
|
|
$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);
|
|
pg_close($dbconn);
|
|
?>
|