<?php

require_once ROOT_PATH . 'config.php';

/* ================= DB CONNECTION ================= */
$conn = new mysqli(
    $config['db_host'],
    $config['db_user'],
    $config['db_pass'],
    $config['db_name']
);

/* ================= ERROR HANDLING ================= */
if ($conn->connect_error) {

    // Log real error (for developer)
    error_log("DB Connection Error: " . $conn->connect_error);

    // Show safe message to user
    die("Database connection error. Please contact admin.");
}

/* ================= CHARSET (IMPORTANT) ================= */
$conn->set_charset("utf8mb4");

?>
