<?php 
//Class DbConnect
class DbConnect {
    //Variable to store database link
    private $dbh;
 
    //Class constructor
    function __construct()
    {
 
    }
 
    //This method will connect to the database
    function connect()
    {
        //Including the constants.php file to get the database constants
        include_once dirname(__FILE__) . '/Constants.php';

        try {
        	$this->dbh = new PDO("dblib:host=".DB_HOST.";dbname=".DB_NAME, DB_USERNAME, DB_PASSWORD);        
        }catch(PDOException $exception){
            echo 'Falló la conexión: ' . $e->getMessage();
            die;
        }

        return $this->dbh;
    }
 
}