<?php
class Database {
    private $db;

    public function __construct() {
        try {
            // Use __DIR__ to get the current directory, then move up one level (..)
            $this->db = new SQLite3(__DIR__ . '/../SWBF2Admin.sqlite');
        } catch (Exception $e) {
            echo "Error: " . $e->getMessage();
        }
    }

    public function query($sql) {
        return $this->db->query($sql);
    }

    public function __destruct() {
        $this->db->close();
    }
}
?>
