set_id($id); } return $this->select_one('herstellerinformationen'); } // end get_data public function delete_data($id = false) { if ($id) { $this->set_id($id); } return $this->delete_one('herstellerinformationen'); } // end delete public function create($data) { return $this->create_one('herstellerinformationen', $data); } // end create public function update($data, $id = false) { if ($id) { $this->set_id($id); } return $this->update_one('herstellerinformationen', $data); } // end update public function get_all() { $result = $this->db->query("SELECT id, marke_name, hersteller_name FROM herstellerinformationen ORDER BY hersteller_name"); $data = array(); while ($row = $result->fetch_object()) { $vendor = new stdClass(); $vendor->id = intval($row->id); $vendor->name = $row->marke_name . ' - ' . $row->hersteller_name; $vendor->value = intval($row->id); $vendor->hersteller_id = intval($row->id); $data[] = $vendor; } return $data; } // end get_all public function get_dropdown_data() { return $this->get_all(); } // end get_dropdown_data protected function select_one($table) { if ($this->id) { // Debug-Ausgabe error_log("Vendor select_one - Suche nach ID: " . $this->id); $sql = "SELECT * FROM herstellerinformationen WHERE id = " . intval($this->id); $result = $this->db->query($sql); // Debug-Ausgabe error_log("Vendor select_one - SQL: " . $sql); if ($result && $result->num_rows > 0) { return $result->fetch_object(); } } return false; } }// end ItemTypeDefinition_Edit /* EOF */