<?php
// config/db.php

declare(strict_types=1);

$db_host = "localhost";
$db_name = "oned350261_scsgdth";
$db_user = "oned350261_scsgdth2026";
$db_pass = "Bijoy@1881G";

try {
    $pdo = new PDO(
        "mysql:host={$db_host};dbname={$db_name};charset=utf8mb4",
        $db_user,
        $db_pass,
        [
            PDO::ATTR_ERRMODE            => PDO::ERRMODE_EXCEPTION,
            PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
            PDO::ATTR_EMULATE_PREPARES   => false,
        ]
    );
} catch (PDOException $e) {
    // In production, log errors instead of showing details
    http_response_code(500);
    exit("Database connection failed.");
}
