array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'pt_BR', ), 'this' => array ( 0 => 'function.pg-connection-status.php', 1 => 'pg_connection_status', ), 'up' => array ( 0 => 'ref.pgsql.php', 1 => 'Funções PostgreSQL', ), 'prev' => array ( 0 => 'function.pg-connection-reset.php', 1 => 'pg_connection_reset', ), 'next' => array ( 0 => 'function.pg-consume-input.php', 1 => 'pg_consume_input', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/pgsql/functions/pg-connection-status.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
pg_connection_status — Get connection status
pg_connection_status() returns the status of
the specified connection
.
Versão | Descrição |
---|---|
8.1.0 |
O parâmetro connection agora espera uma instância de PgSql\Connection;
anteriormente, um resource era esperado.
|
Exemplo #1 pg_connection_status() example
<?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';
}
?>