MDIS/src/database.php

14 lines
342 B
PHP
Raw Normal View History

2020-05-18 15:42:14 +02:00
<?php
function connectDatabase($user, $pass, $db) {
$unix_socket = '.mysql/mysql.sock';
$charset = 'utf8mb4';
$dsn = "mysql:unix_socket=$unix_socket;dbname=$db;charset=$charset";
$db_connection = new PDO($dsn, $user, $pass);
return $db_connection;
}
function closeDatabase($db_connection) {
$db_connection = null;
}