<?php

/**
 * Database config variables
 */
define("DB_HOST", "localhost");
define("DB_USER", "root");
define("DB_PASSWORD", "");
define("DB_DATABASE", "login");

class DB_Connect {
    private $conn;

    // Connecting to database
    public function connect() {
        
        // Connecting to mysql database
        $this->conn = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);
		
		// Check for database connection error
        if (mysqli_connect_errno()) {
            echo "Failed to connect to MySQL: " . mysqli_connect_error();
        }
        // return database handler
        return $this->conn;
    }
}

$db = new Db_Connect();
$this->conn = $db->connect();

?>
