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: Fri, 22 Aug 2008

view this page in

pg_Close

(PHP 4, PHP 5)

pg_CloseCierra una conexión PostgreSQL

Descripción

bool pg_close ( int $connection )

Devuelve FALSE si connection no es un indice de conexión valido y TRUE en cualquier otro caso. Cierra la conexión a la base de datos PostgreSQL asociada con el indice de conexión pasado como parámetro.



pg_Connect> <pg_client_encoding
Last updated: Fri, 22 Aug 2008
 
add a note add a note User Contributed Notes
pg_Close
nox at macports dot org
27-Jul-2007 10:02
An E_WARNING level warning is generated if the supplied argument is not a valid postgresql link resource.
amays
16-Nov-2005 12: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 03: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: Fri, 22 Aug 2008
 
 
show source | credits | sitemap | contact | advertising | mirror sites