<?php
class Database
{
    private $host;
    private $db_name;
    private $username;
    private $password;
    public $conn;

    public function __construct()
    {
        $this->host = '127.0.0.1'; // Change as needed
        $this->db_name = 'esquinak_guesthouse'; // Change as needed
        $this->username = 'esquinak_guesthouse'; // Change as needed
        $this->password = 'GU3ST.hous3'; // Change as needed
    }

    public function getConnection()
    {
        $this->conn = null;

        try {
            $this->conn = new PDO("mysql:host=" . $this->host . ";dbname=" . $this->db_name, $this->username, $this->password);
            $this->conn->exec("set names utf8");
            $this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        } catch (PDOException $exception) {
            throw $exception;
        }

        return $this->conn;
    }
}
?>