<?php
/**
 * Database Connection File for XAMPP
 * Location: public_html/connections/connect.php
 */

define('DB_HOST', 'localhost');
define('DB_USER', 'root');       // Default XAMPP MySQL username
define('DB_PASS', '');           // Default XAMPP MySQL password (empty)
define('DB_NAME', 'mibuildqc_db');   // Database name created in phpMyAdmin
define('DB_PORT', '3306');

try {
    $dsn = "mysql:host=" . DB_HOST . ";dbname=" . DB_NAME . ";port=" . DB_PORT . ";charset=utf8mb4";
    $options = [
        PDO::ATTR_ERRMODE            => PDO::ERRMODE_EXCEPTION,
        PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
        PDO::ATTR_EMULATE_PREPARES   => false,
    ];
    
    $pdo = new PDO($dsn, DB_USER, DB_PASS, $options);
} catch (PDOException $e) {
    die("Database Connection Error: " . $e->getMessage());
}
?>