36 lines
911 B
PHP
36 lines
911 B
PHP
|
<?php
|
||
|
|
||
|
namespace ppb\Model;
|
||
|
|
||
|
use ppb\Library\Msg;
|
||
|
|
||
|
abstract class Database {
|
||
|
|
||
|
/**
|
||
|
* Zugangsdaten für die Datenbank
|
||
|
*/
|
||
|
private $dbName = "pbs2h22aal_av"; //Datenbankname
|
||
|
private $linkName = "mysql.pb.bib.de"; //Datenbank-Server
|
||
|
//Administration: https://mysql.pb.bib.de/phpMyAdmin/
|
||
|
private $user = "pbs2h22aal"; //Benutzername
|
||
|
private $pw = "Iggibib!"; //Passwort
|
||
|
|
||
|
/**
|
||
|
* Stellt eine Verbindung zur Datenbank her
|
||
|
*
|
||
|
* @return \PDO Gibt eine Datenbankverbindung zurueck
|
||
|
*/
|
||
|
public function linkDB() {
|
||
|
try {
|
||
|
$pdo = new \PDO("mysql:dbname=$this->dbName;host=$this->linkName"
|
||
|
, $this->user
|
||
|
, $this->pw
|
||
|
, array(\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION));
|
||
|
return $pdo;
|
||
|
} catch (\PDOException $e) {
|
||
|
new Msg(true, null, $e);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|