Delete Methode implementiert, nicht getestet

This commit is contained in:
Maximilian Heer 2023-12-11 16:03:00 +01:00
parent 7e034abf8c
commit e4003ad37d
2 changed files with 20 additions and 0 deletions

View File

@ -16,5 +16,10 @@
$result=$this->db->insertEnthaelt($data); $result=$this->db->insertEnthaelt($data);
return json_encode($result); return json_encode($result);
} }
public function deleteEnthaelt($id){
$result=$this->db->deleteEnthaelt($id);
return json_encode($result);
}
} }
?> ?>

View File

@ -48,5 +48,20 @@
return false; return false;
} }
} }
public function deleteEnthaelt($id){
$pdo=$this->linkDB();
$params = array();
$sql = "DELETE FROM Enthaelt WHERE id=:id";
$params[":id"] = $id;
try{
$stmt = $pdo->prepare($sql);
$stmt->execute($params);
return true;
}
catch(\PDOExeption $e){
return false;
}
}
} }
?> ?>