<?php
namespace Core;

// Include the config file for necessary DB variables
require_once dirname(__DIR__, 1) . '/config.php';


class DB {
    private $mysqli;

    public function __construct() {
        $this->connect();
    }

    private function connect() {
        $this->mysqli = new \mysqli(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE);
        if ($this->mysqli->connect_error) {
            die("Connection failed: " . $this->mysqli->connect_error);
        }
    }

    public function getConnection() {
        return $this->mysqli;
    }
}

