db = $db); } public function close() { return odbc_close($this->db); } public function query($query) { $res = odbc_exec($this->db, $query) or die("Error: wrong SQL query #$query#"); return $res; } public function fetchAllArray($query) { $res = $this->query($query); $to = odbc_num_fields($res); while (odbc_fetch_row($res)) { for ($i = 1; $i <= $to; $i++) { $row [odbc_field_name($res, $i)] = trim(odbc_result($res, $i)); } $rows[] = $row; } return ($rows)? $rows : array(); } public function fetchOneArray($query) { $res = $this->query($query); if (!odbc_fetch_row($res)) return array (); $to = odbc_num_fields($res); for ($i = 1; $i <= $to; $i++) { $row [odbc_field_name($res, $i)] = trim(odbc_result($res, $i)); } return $row; } } ?>