diff --git a/index.php b/index.php index 79b81a5c..a40a8dc7 100644 --- a/index.php +++ b/index.php @@ -72,6 +72,7 @@ if ( DATABASE_USER, DATABASE_PASSWORD ); + $database->connect(); /** * Options diff --git a/src/classes/wishthis/Database.php b/src/classes/wishthis/Database.php index f14eb5c4..9681b8c7 100644 --- a/src/classes/wishthis/Database.php +++ b/src/classes/wishthis/Database.php @@ -28,6 +28,10 @@ class Database public string $user, public string $password, ) { + } + + public function connect(): void + { $dsn = 'mysql:host=' . $this->host . ';dbname=' . $this->database . ';port=3306;charset=utf8'; $options = array('placeholders' => array()); diff --git a/src/pages/install.php b/src/pages/install.php index fa1be622..32a4e204 100644 --- a/src/pages/install.php +++ b/src/pages/install.php @@ -256,6 +256,7 @@ switch ($step) { $_SESSION['DATABASE_USER'], $_SESSION['DATABASE_PASSWORD'] ); + $database->connect(); unset($_SESSION); $database->query('SET foreign_key_checks = 0;');