man->user->HasRight($this->adminRight)) { return 403; // You shall not pass! } $qry = "INSERT INTO Personal_Lehrgänge (Personal, Lehrgänge) VALUES (?, ?)"; if ($stmt = $this->db->prepare($qry)) { $stmt->bind_param("ii", $ids["Personal"], $ids["Lehrgänge"]); $stmt->execute(); if (1==$stmt->affected_rows) { $this->man->AddMessage("Personalausbildung hinzugefügt!"); return 201; } else { return 200; } } else { $this->man->AddMessage("Mysql error: ".$this->db->error); } return 500; // Should not reach this stage } protected function remove($ids) { if ($ids["Lehrgänge"]==null || $ids["Personal"]==null) { return 400; } if (!$this->man->user->HasRight($this->adminRight)) { return 403; // You shall not pass! } $qry = "DELETE FROM Personal_Lehrgänge WHERE Lehrgänge = ? AND Personal = ?"; if ($stmt = $this->db->prepare($qry)) { $stmt->bind_param("ii", $ids["Lehrgänge"], $ids["Personal"]); $stmt->execute(); if (1==$stmt->affected_rows) { $this->man->AddMessage("Personalausbildung entfernt!"); return 200; } else { return 404; } } else { $this->man->AddMessage("Mysql error: ".$this->db->error); return 500; } } }