Php/docs/function.pg-connection-status

提供:Dev Guides
< Php
移動先:案内検索

pg_connection_status

(PHP 4 >= 4.2.0, PHP 5, PHP 7)

pg_connection_status 接続ステータスを取得する


説明

pg_connection_status ( resource $connection ) : int

pg_connection_status() は、 connection で指定した接続のステータスを返します。


パラメータ

connection
PostgreSQL データベースの接続リソース。


返り値

PGSQL_CONNECTION_OK あるいは PGSQL_CONNECTION_BAD


例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';  }    ?>

参考