<?php
// Set timezone to Indian Standard Time (IST)
date_default_timezone_set('Asia/Kolkata');

$host = 'localhost';
$dbname = 'srihari';
$username = 'root';
$password = '';

// Set up a PDO connection 

// Define global variable for database connection
global $pdo;

try {
    $pdo = new PDO("mysql:host=$host;dbname=$dbname;charset=utf8mb4", $username, $password);
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

    // Set MySQL timezone to IST (GMT+5:30)
    $pdo->exec("SET time_zone = '+05:30'");
} catch (PDOException $e) {
    die("Database connection failed: " . $e->getMessage());
}
