Reputation: 14614
do i need manually call disconnect()
?
for example
<?php
// Create a valid DB object named $db
// at the beginning of your program...
require_once 'DB.php';
$db =& DB::connect('pgsql://usr:pw@localhost/dbnam');
if (PEAR::isError($db)) {
die($db->getMessage());
}
// Proceed with a query...
$res =& $db->query('SELECT * FROM clients');
// Always check that result is not an error
if (PEAR::isError($res)) {
$db->disconnect(); //??????????
die($res->getMessage());
}
................
working
$db->disconnect();//??????????
return $value;
?>
Upvotes: 0
Views: 329
Reputation: 34214
No you don't need to disconnect from a database. It might be helpful for a long running script to use this operation, but your connection gets closed once the script has finished anyway.
Upvotes: 2