diff options
| author | Horus3 | 2016-09-28 14:43:44 +0200 |
|---|---|---|
| committer | Horus3 | 2016-09-28 14:43:44 +0200 |
| commit | 6decb91aa4cc27c83c866d1b128dc719aeb1c986 (patch) | |
| tree | 477a08f5296bbf4ab75b53893b25f900b6e0ad8f /intern.gospeladlershof.de/code/db.php | |
| parent | 4c39424720d6be708896f42b73a93df3c2637a10 (diff) | |
| parent | 006da29841a225675fc7dc4981b69336409737e1 (diff) | |
| download | gospeladlershof.de-6decb91aa4cc27c83c866d1b128dc719aeb1c986.tar.gz | |
Merge branch 'master' of git.iamfabulous.de:gospeladlershof.de
Diffstat (limited to 'intern.gospeladlershof.de/code/db.php')
| -rw-r--r-- | intern.gospeladlershof.de/code/db.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/intern.gospeladlershof.de/code/db.php b/intern.gospeladlershof.de/code/db.php new file mode 100644 index 0000000..8385ed5 --- /dev/null +++ b/intern.gospeladlershof.de/code/db.php @@ -0,0 +1,25 @@ +<?php +function get_db() { + require_once __DIR__ . '/config.php'; + require_once __DIR__ . '/secrets.php'; // beinhaltet die Parameter für die Datenbank + + try { + $db = new pdo($dsn, $db_user, $db_passwd); + } catch (Exception $e) { + error_log($e->getMessage()); + + unset($dsn); + unset($db_user); + unset($db_passwd); + + return false; + } + $db->exec('SET CHARACTER SET utf8'); + + unset($dsn); + unset($db_user); + unset($db_passwd); + + return $db; +} + |
