db = $db); } public function close() { return mysql_close($this->db); } public function query($query) { $res = mysql_query($this->db, $query) or die("Error: wrong SQL query #$query#"); return $res; } public function fetchAllArray($query) { $res = $this->query($query); while ($row = mysql_fetch_array ($res)) $rows[] = $row; mysql_free_result($res); return ($rows) ? $rows : array(); } public function fetchOneArray($query) { $res = $this->query($query); $row = mysql_fetch_array($res); mysql_free_result($res); return ($row) ? $row : array(); } } ?>