con = sqlsrv_connect($this->server, [ "Database" => $this->database, "UID" => $this->user, "PWD" => $this->password, "CharacterSet" => "UTF-8" ]); //Check the connection if(!$this->con) { echo $this->errors(sqlsrv_errors()); die(); } } //SQLSRV errors public function errors($errors) { $e['info'] = "Error information"; foreach($errors as $error) { $e['SQLState'] = $error['SQLSTATE']; $e['code'] = $error['code']; $e['message'] = $error['message']; } return $e['message']; } } ?>