This commit is contained in:
2019-07-04 13:37:20 +02:00
parent 6bc1a522a1
commit 9c1052e392
3 changed files with 17 additions and 9 deletions

View File

@@ -47,15 +47,9 @@ class Database
return $statement->execute(); return $statement->execute();
} }
/** public function deleteQuestion($id)
* Löscht den Taks mit der ID $id aus der Tabelle tasks
*
* @param int $id
* @return bool, falls Löschen erfolgreich
*/
public function deleteTask($id)
{ {
$statement = $this->connection->prepare("DELETE FROM tasks WHERE id = ?"); $statement = $this->connection->prepare("DELETE FROM questions WHERE id = ?");
$statement->bind_param("i", $id); $statement->bind_param("i", $id);
return $statement->execute(); return $statement->execute();
} }

View File

@@ -0,0 +1,14 @@
<?php
require_once(__DIR__ . '/Database.php');
$id = $_POST['id'];
$db = new Database();
$db->deleteQuestion($id);
header("Location: questions-show.php");
?>

View File

@@ -14,6 +14,6 @@ $db = new Database();
$db->updateQuestion($id, $question, $answer0, $answer1, $answer2, $solution); $db->updateQuestion($id, $question, $answer0, $answer1, $answer2, $solution);
//header("Location: questions-show.php"); header("Location: questions-show.php");
?> ?>