<?php
// Database configuration
$host = 'localhost';
$db   = 'OOH';
$user = 'sa';
$pass = 'ntha';

$dsn = "sqlsrv:Server=localhost;Database=OOH;Encrypt=false;TrustServerCertificate=true";
$options = [
    PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
    PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC
];

try {
    $pdo = new PDO($dsn, $user, $pass, $options);
    return $pdo;
} catch (PDOException $e) {
    error_log("Database connection failed: " . $e->getMessage(), 3, __DIR__ . '/db_error.log');
    return null;
}