This commit is contained in:
William 2022-01-21 21:16:14 +01:00
parent 972574d293
commit 836c5dc183

View File

@ -21,16 +21,10 @@ class Database
private function connectWithMySQL(array $args): object private function connectWithMySQL(array $args): object
{ {
$host = $args['host']; $dsn = "mysql:host={$args['host']};dbname={$args['database']};charset={$args['charset']}";
$database = $args['database'];
$charset = $args['charset'];
$user = $args['user'];
$password = $args['password'];
$dsn = "mysql:host=$host;dbname=$database;charset=$charset";
$options = [ $options = [
PDO::ATTR_PERSISTENT => true, PDO::ATTR_PERSISTENT => true,
]; ];
return new PDO($dsn, $user, $password, $options); return new PDO($dsn, $args['user'], $args['password'], $options);
} }
} }