<?php
class DB {
	private $link;	

	//keelame otse objekti loomise
	private function __construct() {}

	//loome ├╝henduse andmebaasiga
	public static function connect($data) {
		$object = new self;
		
		$object->link = @mysql_connect($data['host'], $data['user'], $data['password']) or die($object->print_error());
		mysql_select_db($data['database'], $object->link) or die($object->print_error());

		return $object;
	}