From e8ce6c6f36b3d910c136fc7697a29d95839b8d09 Mon Sep 17 00:00:00 2001 From: patrickzerhusen Date: Thu, 16 Apr 2026 15:23:17 +0200 Subject: [PATCH] init adapted to server --- init.php | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/init.php b/init.php index 7e18a92..dcabee3 100644 --- a/init.php +++ b/init.php @@ -1,6 +1,6 @@ PDO::ERRMODE_EXCEPTION, - PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, - PDO::ATTR_EMULATE_PREPARES => false - ]; - - $dsn = "pgsql:host=$host;dbname=$db;port=$port"; - $pdo = new PDO($dsn, $user, $pass, $opt); +// Initializes Database Connection +try { + $opt = [ + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, + PDO::ATTR_EMULATE_PREPARES => false + ]; + $dsn = "pgsql:host=$host;dbname=$db;port=$port"; + $pdo = new PDO($dsn, $user, $pass, $opt); - // Error-Message - } catch(PDOException $e) { - echo "Error: ".$e->getMessage(); - } +// Creates Error Message +} catch(PDOException $e) { + echo "Error: ".$e->getMessage(); +} + ?> \ No newline at end of file