<?php
namespace App\DB;
use PDO;
use PDOException;
require_once __DIR__.'/../App/Config.php';
class DBConnection{
    private $dbConnection;
    function setConnection() {
        $conn = "nOk";
        try {
            $dbConn = new PDO("mysql:host=".DB_HOST.";charset=utf8;dbname=".DB_NAME."", DB_USER, DB_PASS);  
            $dbConn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
            $conn = "OK";
            $this->dbConnection = $dbConn;
        } catch(PDOException $e) {
            $conn = $e->getMessage();
        }
        return $conn;
    }
    
    function getConnection() {
        return $this->dbConnection;
    }
}
?>