<?php
/**
 * Database configuration and PDO connection
 * Nazareth Church Management System
 */

// Use 127.0.0.1 instead of localhost to avoid MySQL socket path issues on macOS
$db_host = '127.0.0.1';
$db_name = 'imscopyc_nazareth';
$db_user = 'imscopyc_nazareth_admin';
$db_pass = '}w$D6)4f5Lx*the3';

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,
        ]
    );
} catch (PDOException $e) {
    die('Database connection failed: ' . $e->getMessage());
}
