File "data_view.php"

Full path: /www/Lazurite/3/data_view.php
File size: 796 B
MIME-type: text/x-php
Charset: utf-8

Download   Open   Back

<?php

print "<meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\">";

$DATA_TABLE = "lazurite.data_log_3";
$HOST = "192.168.100.153";
$DB = "arduino";
$USER = "postgres";
$PASS = "postgres";

$conn = pg_connect("
	host	=	". $HOST. "
	dbname	=	". $DB. "
	user	=	". $USER. "
	password=	". $PASS. "
");

$sel = "SELECT * FROM " .$DATA_TABLE ." WHERE datetime > '2018-11-05 16:18' ORDER BY datetime desc";
$res = pg_query($conn,$sel);
$ct = pg_num_rows($res);

print "<TABLE BORDER='1'><TR ALIGN='center'><TD>日時</TD><TD>平均電圧</TD></TR>";
for($ii = 0 ;$ii < $ct;$ii++)
{
	$row = pg_fetch_array($res,$ii);
	print "<TR><TD  width='180'>";
	print $row[0];
	print "</TD><TD width='80'>";
	print number_format($row[1],"5","." ,"");
	print "</TD></TR>";
}


print "</TABLE>";
?>

PHP File Manager