note 114034 added to mysqli.close

From: Date: Sat, 04 Jan 2014 12:23:58 +0000
Subject: note 114034 added to mysqli.close
Groups: php.notes 
Request: Send a blank email to php-notes+get-198103@lists.php.net to get a copy of this message
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(); } }; ?> ---- Server IP: 64.71.164.2 Probable Submitter: 76.121.245.200 ---- Manual Page -- http://php.net/manual/en/mysqli.close.php Edit -- https://master.php.net/note/edit/114034 Del: integrated -- https://master.php.net/note/delete/114034/integrated Del: useless -- https://master.php.net/note/delete/114034/useless Del: bad code -- https://master.php.net/note/delete/114034/bad+code Del: spam -- https://master.php.net/note/delete/114034/spam Del: non-english -- https://master.php.net/note/delete/114034/non-english Del: in docs -- https://master.php.net/note/delete/114034/in+docs Del: other reasons-- https://master.php.net/note/delete/114034 Reject -- https://master.php.net/note/reject/114034 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#198103) next »