<?php
class DbConnection
{
    private $conn;

    public function __construct()
    {
        $servername = "localhost";
        $username = "staffethschorg_staffPortal";
        $password = "fP}S}yLSc*!C";
        $dbname = "staffethschorg_staff_portal";

        try {
            // Create connection
            $this->conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
            $this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        } catch (PDOException $e) {
            echo 'Connection failed' . $e->getMessage();
        }
    }

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

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


