<?php
error_reporting(0);

define('DB_SERVER',   'localhost');
define('DB_USERNAME', 'bgwqdvat_newchickenBOND');
define('DB_PASSWORD', 'bgwqdvat_newchickenBOND');
define('DB_NAME',     'bgwqdvat_newchickenBOND');

/**
 * Get a singleton mysqli connection
 */
function db(): mysqli {
    static $conn = null;
    if ($conn === null) {
        $conn = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);
        if (!$conn) { die('DB connection failed: ' . mysqli_connect_error()); }
        mysqli_set_charset($conn, 'utf8mb4');
    }
    return $conn;
}
