<?php 
// $db = Database::getInstance();

class Database {
    private static $instance = null;
    private $mysqli;
    private $host;
    private $dbname;
    private $user;
    private $password;
    private $Database;

    public  function __construct() {
        $host = 'localhost';
        $dbname = 'laniacc';
        $user = 'laniacc';
        $password = '<U]93Cl3';

        try {
            $this->mysqli = new mysqli($host, $user, $password, $dbname);
            
            // Verificar conexión
            if ($this->mysqli->connect_error) {
                throw new Exception("Database: Conexión fallida. " . $this->mysqli->connect_error);
            }
            
        } catch (Exception $e) {
            throw new Exception("Database: Error . " . $e->getMessage());
        }
    }

    public static function getInstance() {
        if (self::$instance === null) {
            self::$instance = new Database();
        }
        return self::$instance->mysqli;
    }


}

?>