<?php
// Database Configuration
$host = 'localhost';
$username = 'adsiosoo_recuirment_portal';
$password = 'LWeEZXnEk=zB'; // Default XAMPP password is empty
$dbname = 'adsiosoo_recuirment_portal';

try {
    $pdo = new PDO("mysql:host=$host;dbname=$dbname;charset=utf8mb4", $username, $password);
    // Set the PDO error mode to exception
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
} catch(PDOException $e) {
    // Return structured error if connection fails, useful for API
    header('Content-Type: application/json');
    http_response_code(500);
    echo json_encode(['error' => 'Database connection failed: ' . $e->getMessage()]);
    exit;
}
?>
