user = $user; $this->pass = $pass; $this->host = $host; $this->dbname = $dbname; $this->connect(); } function connect() { $this->db = mysql_connect($this->host, $this->user, $this->pass) or $this->error("Verbindungsaufbau fehlgeschlagen"); mysql_select_db($this->dbname); } function error($msg) { die($msg . ": " . @mysql_error()); } function query($query) { $this->res = mysql_query($query, $this->db) or $this->error("Fehler bei Datenbankanfrage"); } function escape_string($string) { return mysql_real_escape_string($string, $this->db); } function numObjects() { return mysql_num_rows($this->res); } function getNextObject() { if (!$this->res) { return; } return mysql_fetch_object($this->res); } } ?>