<?php
// Project/config/database.php

$host = 'localhost';
$db_name = 'school_db'; // Ensure this matches the name in phpMyAdmin
$username = 'root';     // Default XAMPP username
$password = '';         // Default XAMPP password is empty

try {
    // Set up DSN (Data Source Name)
    $dsn = "mysql:host=$host;dbname=$db_name;charset=utf8mb4";
    
    // Create the PDO instance
    $pdo = new PDO($dsn, $username, $password);
    
    // Set Error Mode to Exception so we can see errors during testing
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    
    // Set default fetch mode to Associative Array
    $pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);

} catch (PDOException $e) {
    // If connection fails, stop the script and show why
    die("Database Connection Failed: " . $e->getMessage());
}
// Google Gemini AI Configuration
define('GEMINI_API_KEY', 'AIzaSyBBNo_dOJM9J1J6XKQIve9QUvRNMgjLz78');
?>