note 45187 added to function.mysql-close
| From: | bkimball1 at yahoo dot com | Date: | Sat, 28 Aug 2004 18:20:21 +0000 |
| Subject: | note 45187 added to function.mysql-close | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-75503@lists.php.net to get a copy of this message | ||
The following database class code snippet (similar to that posted below) results in a PHP Warning.
I am unable to use mysql_close() in any class-based context, and I assume the previous post was
intended to draw attention to this...
Warning: mysql_close(): 18 is not a valid MySQL-Link resource
/*********************************************************************
* bool CdbConnection::closeDatabase(void);
* Attempts to close an open database connection.
* Parameters: N/A
* Returns:
* bool; Success/Fail indication.
*********************************************************************/
function closeDatabase() {
$bvStatus = false;
if ($this->isConnected()) {
// Connected; try to close the connection.
if (mysql_close($this->hndConnection)) {
// Close attempt succeeded.
$this->bConnected = false;
$this->hndConnection = NULL;
$bvStatus = true;
} else {
// Close attempt failed.
$bvStatus = false;
}
} else {
// No open connection; close was successful. Be sure the connection handle is purged.
$bvStatus = true;
$this->hndConnection = NULL;
}
return ($bvStatus);
}
----
Manual Page -- http://www.php.net/manual/en/function.mysql-close.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+45187
Delete -- http://master.php.net/manage/user-notes.php?action=delete+45187&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+45187&report=yes
Search -- http://master.php.net/manage/user-notes.php