Add database type option

This commit is contained in:
Gregory Trolliet 2020-11-25 19:43:40 +01:00
parent 97c75691ce
commit ea95c63e18
3 changed files with 6 additions and 4 deletions

4
db.php
View file

@ -22,9 +22,7 @@ class DataBase
public function init()
{
require_once 'dbconfig.php';
$dsn = 'pgsql:dbname=' . $dbname
. ';host=' . $host
. ';port=' . $port;
$dsn = "$type:dbname=$dbname;host=$host;port=$port";
try {
$this->db = new PDO($dsn, $username, $password);
$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);