fixed db connection
This commit is contained in:
+19
-7
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user