File "send_area.php"

Full path: /www/gps_socket/nakagusuku/send_area.php
File size: 2.29 KiB (2341 bytes)
MIME-type: text/x-php
Charset: utf-8

Download   Open   Back

<?php
// 一行区切り "~"
// 項目区切り ","

//===============================================
//	CommonUtilities
//	備考		:	
//	更新		:	2014/09/25 KMK-kuroda
//===============================================
$HOST = "192.168.100.153";
$DB = "cnbs";
$USER = "postgres";
$PASS = "am#71ZJ*";

try
{
	//================================================
	//	データベース接続
	//	備考		:	
	//	更新		:	2014/09/25 KMK-kuroda
	//================================================
	$conn = pg_connect("
		host	=	". $HOST. "
		dbname	=	". $DB. "
		user	=	". $USER. "
		password=	". $PASS. "
	");
	if (!$conn)
	{
		throw new Exception("データベースへの接続に失敗しました");
	}

	// SELECT
	$refTsTerm = "SELECT * FROM nakagusuku.area ORDER BY areano ;";
	if (!($resRefTsTerm = pg_query($conn, $refTsTerm)))
	{
		throw new Exception("データ読み込みに失敗<br />". $resRefTsTerm. "<br />". pg_last_error(). "<br />");
	}

	for ($i = 0 ; $i < pg_num_rows($resRefTsTerm) ; $i++){
		$rows = pg_fetch_array($resRefTsTerm, $i, PGSQL_ASSOC);
		print($rows['area_pkid']);
		print("," . $rows['areano']);
		print("," . $rows['areaname']);
		print("," . $rows['mode']);
		print("," . $rows['disp']);
		print("," . $rows['row']);
		print("," . $rows['col']);
		print("," . $rows['xpos1']);
		print("," . $rows['ypos1']);
		print("," . $rows['xpos2']);
		print("," . $rows['ypos2']);
		print("," . $rows['xpos3']);
		print("," . $rows['ypos3']);
		print("," . $rows['xpos4']);
		print("," . $rows['ypos4']);
		print("," . $rows['dispoffsetx']);
		print("," . $rows['dispoffsety']);
		print("," . $rows['blockoffsetx1']);
		print("," . $rows['blockoffsety1']);
		print("," . $rows['width1']);
		print("," . $rows['height1']);
		print("," . $rows['blockoffsetx2']);
		print("," . $rows['blockoffsety2']);
		print("," . $rows['width2']);
		print("," . $rows['height2']);
		print("," . $rows['blockoffsetx3']);
		print("," . $rows['blockoffsety3']);
		print("," . $rows['width3']);
		print("," . $rows['height3']);
		print("," . $rows['update'].'<br>');
	}
}
catch(Exception $exc)
{
	print $exc->getMessage();
}

//===============================================
//	Postgresql終了処理
//	備考		:	
//	更新		:	2012/10/19 KMK-Teraoka
//===============================================
pg_close($conn);

?>

PHP File Manager