Mini Kabibi Habibi

Current Path : C:/xampp/htdocs/clinic/includes/
Upload File :
Current File : C:/xampp/htdocs/clinic/includes/db.php

<?php
$host = 'localhost';
$dbname = 'clinic';
$username = 'root';   // Default for XAMPP/WAMP
$password = '';       // Default for XAMPP/WAMP
$charset = 'utf8mb4'; // Supports full Unicode (emojis, symbols, etc.)

$dsn = "mysql:host=$host;dbname=$dbname;charset=$charset";

$options = [
    PDO::ATTR_ERRMODE            => PDO::ERRMODE_EXCEPTION, // Throw exceptions on errors
    PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,       // Return associative arrays
    PDO::ATTR_EMULATE_PREPARES   => false,                  // Use native prepared statements
];

try {
    $pdo = new PDO($dsn, $username, $password, $options);
} catch (PDOException $e) {
    // In production, log the error instead of showing it
    die("Connection failed: " . $e->getMessage());
}
?>