restful-demo/config/Database.php

18 lines
441 B
PHP
Raw Normal View History

2022-09-30 18:41:40 +02:00
<?php
class Database{
private $host = 'hostname';
private $user = 'user';
private $password = "password";
private $database = "database";
public function getConnection(){
$conn = new mysqli($this->host, $this->user, $this->password, $this->database);
if($conn->connect_error){
die("Error failed to connect to MySQL: " . $conn->connect_error);
} else {
return $conn;
}
}
}
?>