PHP Classes

Error on disconnect

Recommend this page to a friend!

      Simple PHP MySQLi  >  All threads  >  Error on disconnect  >  (Un) Subscribe thread alerts  
Subject:Error on disconnect
Summary:When disconnect is called and the database is not initialised
Author:William Cairns
Date:2017-09-09 15:50:03

  1. Error on disconnect   Reply   Report abuse  
William Cairns - 2017-09-09 15:50:03
While adding PHPUnit tests to my project using this package I got numerous errors. By checking if it is initialized before closing I could prevent the errors.

* Disconnect from db server
* Called automatically from __destruct function
public function disconnect()
if( self::$inst != null )

  2. Re: Error on disconnect   Reply   Report abuse  
Bennett Stone - 2017-09-09 16:39:14 - In reply to message 1 from William Cairns
Good catch! I don't actually still support this particular class as I created a PDO version here: which is more secure.

The same methods are implemented within SimplePDO so converting between them is quite easy as well.