pg_connection_status
(PHP 4 >= 4.2.0, PHP 5)
pg_connection_status — 接続ステータスを取得する
説明
int pg_connection_status
( resource $connection
)
pg_connection_status() は、 connection で指定した接続のステータスを返します。
パラメータ
- connection
-
PostgreSQL データベースの接続リソース。
返り値
PGSQL_CONNECTION_OK あるいは PGSQL_CONNECTION_BAD 。
例
Example#1 pg_connection_status() の例
<?php
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
$stat = pg_connection_status($dbconn);
if ($stat === PGSQL_CONNECTION_OK) {
echo 'Connection status ok';
} else {
echo 'Connection status bad';
}
?>