host = $config['host']; $this->port = parse_ini_file($_SERVER['DOCUMENT_ROOT'].'/../env_config.ini')['local_mysql_port']; $this->user = $config['username']; $this->pass = $config['password']; $this->createConn(); } private function createConn() { $this->mysqli = new mysqli($this->host . ":" . $this->port, $this->user, $this->pass, $this->dbName); } public function query($sql) { return $this->mysqli->query($sql); } public function changeDB($dbName) { $this->dbName = $dbName; $this->mysqli->select_db($dbName); } public function __destruct() { $this->mysqli->close(); } }