fixed db connection

This commit is contained in:
2026-09-10 10:28:24 +02:00
parent 62bfb4d77f
commit 88c454c5d4
4 changed files with 95 additions and 216 deletions
+19 -7
View File
@@ -1,7 +1,19 @@
<?php␍
//dependent dropdown in php Database Connection␍
$conn = new mysqli('localhost', 'u00wiumd4xnrd', 'ukowysga7w5x', 'dbcov4clvrmrzn');␍
if ($conn->connect_error) {␍
die("Connection failed: " . $conn->connect_error);␍
}␍
?>
<?php
//dependent dropdown in php Database Connection
require_once __DIR__ . '/../vendor/autoload.php';
if (!isset($_ENV['DB_HOST'])) {
Dotenv\Dotenv::createImmutable(__DIR__ . '/../')->safeLoad();
}
$conn = new mysqli(
$_ENV['DB_HOST'] ?? 'localhost',
$_ENV['DB_USERNAME'] ?? '',
$_ENV['DB_PASSWORD'] ?? '',
$_ENV['DB_DATABASE'] ?? ''
);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}