note 45187 deleted from function.mysql-close by tomsommer

From: Date: Sat, 28 Aug 2004 20:40:38 +0000
Subject: note 45187 deleted from function.mysql-close by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-75505@lists.php.net to get a copy of this message
Note Submitter: bkimball1 at yahoo dot com ---- 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); }

« previous php.notes (#75505) next »