Update
This commit is contained in:
@@ -41,6 +41,12 @@ class Database
|
||||
return $statement->execute();
|
||||
}
|
||||
|
||||
public function updateQuestion($question, $answer0, $answer1, $answer2, $solution) {
|
||||
$statement = $this->connection->prepare("UPDATE questions SET question=?, answer0 = ?, answer1 = ?, answer2 = ?, solution = ?");
|
||||
$statement->bind_param("ssssi", $question, $answer0, $answer1, $answer2, $solution);
|
||||
return $statement->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Löscht den Taks mit der ID $id aus der Tabelle tasks
|
||||
*
|
||||
|
18
cgi-bin/uebung09/questions-update.php
Normal file
18
cgi-bin/uebung09/questions-update.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
require_once(__DIR__ . '/Database.php');
|
||||
|
||||
$question = $_POST['question'];
|
||||
$answer0 = $_POST['answer0'];
|
||||
$answer1 = $_POST['answer1'];
|
||||
$answer2 = $_POST['answer2'];
|
||||
$solution = $_POST['solution'];
|
||||
|
||||
$db = new Database();
|
||||
|
||||
db->updateQuestion($question, $answer0, $answer1, $answer2, $solution);
|
||||
|
||||
|
||||
//header("Location: questions-show.php");
|
||||
|
||||
?>
|
Reference in New Issue
Block a user