deepsite-project-de4im / db_connect.php
vergen-dev's picture
Upload 28 files
36f2119 verified
raw
history blame contribute delete
477 Bytes
<?php
try {
// Create (or connect to) the SQLite database in the same directory
$db = new PDO('sqlite:' . __DIR__ . '/database.sqlite');
// Set error mode to exceptions
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// Fetch results as associative arrays by default
$db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
} catch (PDOException $e) {
die("Database connection failed: " . $e->getMessage());
}
?>