php separate

This commit is contained in:
2025-12-09 13:14:27 +00:00
parent 94dfd20e84
commit 062a1d1f97
28 changed files with 4702 additions and 0 deletions

23
php/power.php Normal file
View File

@@ -0,0 +1,23 @@
<?php
require_once __DIR__ . '/common.php';
$dbconn = getDBConnection();
// Performing SQL query
$query = "SELECT lat,lon,outagen FROM power WHERE active = true and cwa = 'RLX'";
$result = pg_query($query) or die('Query failed: ' . pg_last_error());
// Printing results in HTML
while ($line = pg_fetch_array($result, null, PGSQL_ASSOC)) {
$array[] = $line;
}
echo json_encode($array);
// Free resultset
pg_free_result($result);
// Close database connection when needed
if (isset($dbconn)) {
pg_close($dbconn);
}
?>