You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
643 B
25 lines
643 B
5 years ago
|
<?php
|
||
|
// used to get mysql database connection
|
||
|
class DatabaseService {
|
||
|
|
||
|
private $db_host = "localhost";
|
||
|
private $db_name = "jwt";
|
||
|
private $db_user = "root";
|
||
|
private $db_password = "root";
|
||
|
private $connection;
|
||
|
|
||
|
public function getConnection(){
|
||
|
|
||
|
$this->connection = null;
|
||
|
|
||
|
try{
|
||
|
$this->connection = new PDO("mysql:host=" . $this->db_host . ";dbname=" . $this->db_name, $this->db_user, $this->db_password);
|
||
|
}catch(PDOException $exception){
|
||
|
echo "Connection failed: " . $exception->getMessage();
|
||
|
}
|
||
|
|
||
|
return $this->connection;
|
||
|
}
|
||
|
}
|
||
|
?>
|