where("book_id = ?", (int) $_GET["book_id"]) ->where("author_id = ?", (int) $_GET["author_id"]) ->setFetchClass(BookHasAuthor::class) ->execute() ->fetch(); if (!$bookHasAuthor) { die("This author is not registered for this book"); } Registry::persistenceDriver()->delete($bookHasAuthor); header("Location: book_edit.php?id=" . (int) $_GET["book_id"]);