note 114034 deleted from mysqli.close by tularis

From: Date: Sun, 05 Jan 2014 16:23:46 +0000
Subject: note 114034 deleted from mysqli.close by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-198113@lists.php.net to get a copy of this message
Note Submitter: elitescripts2000 at yahoo dot com ---- If you want to avoid warnings in your logs you can check if you need to close a DB connection at all before calling mysqli_close()... this is not a fully function class, I left out the Query and other important methods... but my point was the destruct() and close() warning avoidance... <?php class MySQLi_Access { public $link = null; public function Ping() { return ($this->link instanceof mysqli) ? mysqli_ping($this->link) : false; } public function Close() { if ($this->Ping()) mysqli_close($this->link); $this->link = null; } function __destruct() { $this->Close(); } }; ?>

« previous php.notes (#198113) next »