Add database type option
This commit is contained in:
parent
97c75691ce
commit
ea95c63e18
3 changed files with 6 additions and 4 deletions
4
db.php
4
db.php
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue