<?php
$host = 'localhost';
$db   = 'school_checkin';  // 🔧 Ilisi kung lahi imong DB name
$user = 'root';            // 🔧 Default user for XAMPP
$pass = '';                // 🔧 Usually empty sa XAMPP local dev

try {
    // ✅ Create PDO connection with utf8mb4 + proper collation
    $dsn = "mysql:host=$host;dbname=$db;charset=utf8mb4";

    $pdo = new PDO($dsn, $user, $pass, [
        PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
        PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci"
    ]);
} catch (PDOException $e) {
    // ❌ Handle connection error gracefully
    die("Database connection failed: " . $e->getMessage());
}
?>
