<?php
error_reporting(0);

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

/**
 * 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;
}
