File "temrinal.php"
Full path: /www/ansys/qgis/008_shinmoji/mapref/temrinal.php
File size: 1.2 KiB (1233 bytes)
MIME-type: text/x-php
Charset: utf-8
<?php
try
{
$output = array();
$addIndex = 0;
$WORK_STATUS = 0;
$enableSec = 600;
$enableDateTime = date("Y-m-d H:i:s", time() - $enableSec);
//データベース接続
$HOST = "192.168.100.153";
$DB = "ansys";
$USER = "postgres";
$PASS = "am#71ZJ*";
$conn = pg_connect("
host = ". $HOST. "
dbname = ". $DB. "
user = ". $USER. "
password= ". $PASS. "
");
$output[$addIndex++] = "0";
$sql = "SELECT * FROM qgis.ts_terminal";
$sql .= " WHERE app_id='19'";
$sql .= " AND const_id='11'";
$sql .= " AND mesdatetime >= '". $enableDateTime. "'";
if (strcmp($WORK_STATUS, 0) != 0)
$sql .= " AND work_status='". $WORK_STATUS. "'";
$sql .= " ORDER BY regdatetime;";
$res = pg_query($conn, $sql);
if (!($resList = pg_query($conn, $sql)))
throw new Exception("");
$numTemrinal = pg_num_rows($res);
for($iCount = 0; $iCount < $numTemrinal; $iCount++)
{
$row = pg_fetch_array($res, $iCount);
$output[$addIndex++] = $row["terminal_name"]. ",". $row["lon"]. ",". $row["lat"]. ",". $row["work_status"];
}
$numoutput = count($output);
for($iCount = 0; $iCount < $numoutput; $iCount++)
{
if ($iCount > 0)
print "\\n";
print $output[$iCount];
}
}
catch(Exception $exc)
{
print "";
}
?>