<?php
// Database configuration
$dsn = "mysql:host=localhost;dbname=buildnet;charset=utf8";
$username = "root";
$password = "";

try {
    // Create a PDO instance with error handling
    $conn = new PDO($dsn, $username, $password);
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $conn->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
} catch (PDOException $e) {
    // Customize error message or log to a file in production
    die("Database connection failed: " . $e->getMessage());
}
