user = $user; $this->pass = $pass; $this->host = $host; $this->dbname = $dbname; $this->connect(); } function connect() { $this->db = mysqli_connect($this->host, $this->user, $this->pass) or $this->error("Verbindungsaufbau fehlgeschlagen"); mysqli_select_db($this->db, $this->dbname); } function error($msg) { die($msg . ": " . @mysqli_error($this->db)); } function query($query) { $this->res = mysqli_query($this->db, $query) or $this->error("Fehler bei Datenbankanfrage"); } function escape_string($string) { return mysqli_real_escape_string($this->db, $string); } function numObjects() { return mysqli_num_rows($this->res); } function getNextObject() { if (!$this->res) { return; } return mysqli_fetch_object($this->res); } } ?>