note 30628 added to function.pg-close
| From: | mark at redbrick dot dcu dot ie | Date: | Mon, 24 Mar 2003 12:31:28 +0000 |
| Subject: | note 30628 added to function.pg-close | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-45732@lists.php.net to get a copy of this message | ||
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
--
http://www.php.net/manual/en/function.pg-close.php
http://master.php.net/manage/user-notes.php?action=edit+30628
http://master.php.net/manage/user-notes.php?action=delete+30628
http://master.php.net/manage/user-notes.php?action=reject+30628