<?php
$host = getenv('DB_HOST') ?: 'localhost';  // Default to localhost if not set
$user = getenv('DB_USER') ?: 'paysafebd23_test';           // Default to empty string if not set
$pass = getenv('DB_PASS') ?: 'paysafebd23_test';           // Default to empty string if not set
$db = getenv('DB_NAME') ?: 'paysafebd23_test';             // Default to empty string if not set

// Create the connection
$conn = new mysqli($host, $user, $pass, $db);

// Check connection
if ($conn->connect_error) {
    error_log("Connection failed: " . $conn->connect_error);
    die("There was a problem connecting to the database.");
}

if (!$conn->set_charset("utf8mb4")) {
    // Handle charset setting failure if necessary
    error_log("Error loading character set utf8mb4: " . $conn->error);
}
?>
