<?PHP
class DatabaseConnection {
    var $connection;
    var $isConnected;
    var $status;
    
    function DatabaseConnection () {
        $this->connection = null;
        $this->isConnected = false;
        $this->status = "new";
    }

	public static function test() {
		print 'DatabaseConnection: I am here, now and then...';
	}
    
	public static function getConnection() {
	    //mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
	    $conn = new DatabaseConnection();
	    
        $conn->connection = new mysqli('localhost', 'yugofile_live_php', 'IW6&v^1b}Mt-MqxA0ypVL1Q)Pgsc&T(Bw][J', 'yugofile_live');
        // set to UTF-8 to allow for Greek
        mysqli_set_charset($conn->connection, "utf8");
        
        // Check for connection errors and set status
        if ($conn->connection === false) {
            $conn->status = $conn->connection->connect_error;
        } else if (mysqli_connect_errno()) {
            $conn->status = "Connect failed: " . mysqli_connect_error();
        } else {
            $conn->isConnected = true;
            $conn->status = "Connected to: " . $conn->connection->host_info;
        }
		return $conn;
	}

}

?>