18 lines
441 B
PHP
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;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
?>
|