title: Why mysqli doesn't work?
body: <pre><code>class mysql{
  
      function __construct(){
          $this-&gt;connect();
      }
  
      function __destruct(){
          $mysqli = $this-&gt;connect();
          $mysqli-&gt;close();
      }
  
      public function connect(){
  
          static $mysqli;
  
          require_once(ROOT_PATH.'/config/db_conf.php');
  
          @$mysqli = new mysqli($sql_login['host'], $sql_login['user'], $sql_login['password'] , $sql_login['database'], $sql_login['port']);
  
          if(!$mysqli){
              throw new Exception("Failed to connect to MySQL: (" . $mysqli-&gt;connect_errno . ") " . $mysqli-&gt;connect_error);
          }
  
          return $mysqli;
      }
  }
  </code></pre>
  
  <p>When i trying to connect to mysql - everything is fine, but after it i am getting Warning: <code>mysqli::close(): Couldn't fetch mysqli in...</code></p>