restful-demo/config/Database.php
2022-09-30 09:41:40 -07:00

18 lines
441 B
PHP

<?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;
}
}
}
?>