PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

pg_connect> <pg_client_encoding
Last updated: Sun, 25 Nov 2007

view this page in

pg_close

(PHP 4, PHP 5)

pg_close — PostgreSQL과의 접속을 끊는다.

함수 설명

bool pg_close ( int $connection )

올바른 접속지시자(a valid connection index)가 아니라면 거짓(FALSE)를 돌려주고, 반대의 경우 참(TRUE)을 돌려준다. 인수로 주어진 접속지시자에 해당하는 PostgreSQL로의 접속을 끊는다.

Note: 영구적이지 않은 접속은 PHP 스크립트의 종료시 자동으로 닫히므로 대부분의 경우 이 함수를 이용하여 접속을 끊지 않아도 된다.

pg_close() 함수는 pg_pconnect()를 이용한 접속을 끊지 못한다.



pg_connect> <pg_client_encoding
Last updated: Sun, 25 Nov 2007
 
add a note add a note User Contributed Notes
pg_close
nox at macports dot org
27-Jul-2007 01:02
An E_WARNING level warning is generated if the supplied argument is not a valid postgresql link resource.
amays
15-Nov-2005 03:47
pg_close(...) will not technically close a persistent connection but instead returns it back to the connection pool thus giving you the desired effect of having the connection closed within your script.

http://www.sitepoint.com/article/accessing-postgresql-php/3

best wishes to all.
mark at redbrick dot dcu dot ie
24-Mar-2003 06:31
This function closes the current database connection specified by a handle returned from a pg_connect() call.

<?php
    $pgsql_conn
= pg_connect("dbname=mark host=localhost");

    if (
$pgsql_conn) {
        print
"Successfully connected to: " . pg_host($pgsql_conn) . "<br/>\n";
    } else {
        print
pg_last_error($pgsql_conn);
        exit;
    }

   
// Do database stuff here.

   
if(!pg_close($pgsql_conn)) {
        print
"Failed to close connection to " . pg_host($pgsql_conn) . ": " .
      
pg_last_error($pgsql_conn) . "<br/>\n";
    } else {
        print
"Successfully disconnected from database";
    }
?>

Of course you normally wouldn't print a message. 

Regards, --mark

pg_connect> <pg_client_encoding
Last updated: Sun, 25 Nov 2007
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites