<?php
// -------------------------------------------------------------
// PDO Database Connection File
// -------------------------------------------------------------

$host     = "localhost";          // Database host
$dbname   = "investme_pickles"; // Database name
$username = "investme_pickles";   // DB username
$password = "Olympics@2028";   // DB password
$charset  = "utf8mb4";

// Build DSN string
$dsn = "mysql:host=$host;dbname=$dbname;charset=$charset";

// PDO options for security & performance
$options = [
    PDO::ATTR_ERRMODE            => PDO::ERRMODE_EXCEPTION, // Show errors
    PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,       // Fetch assoc arrays
    PDO::ATTR_PERSISTENT         => false,                  // Persistent connection off
    PDO::ATTR_EMULATE_PREPARES   => false                   // True prepared statements
];

try {
    $pdo = new PDO($dsn, $username, $password, $options);
    // Uncomment for debugging
    // echo "Database connected!";
} catch (PDOException $e) {
    die("Database connection failed: " . $e->getMessage());
}
?>
