diff --git a/htdocs/index.php b/htdocs/index.php
index f87bdd0..2c5aca1 100644
--- a/htdocs/index.php
+++ b/htdocs/index.php
@@ -64,7 +64,7 @@ $list = $db->getList();
|
diff --git a/htdocs/lib/Database/DbMessage.php b/htdocs/lib/Database/DbMessage.php
index dca4293..4186ed8 100644
--- a/htdocs/lib/Database/DbMessage.php
+++ b/htdocs/lib/Database/DbMessage.php
@@ -85,6 +85,10 @@ class DbMessage extends Database
public function delete($id)
{
- # code...
+ $sqlString = "DELETE FROM `".$this->table('message')."` WHERE id= :id";
+ $query = $this->connDB->prepare($sqlString);
+ $query->bindParam(":id", $id);
+ $query->execute();
+ return $query->rowCount();
}
}
\ No newline at end of file
diff --git a/htdocs/save.php b/htdocs/save.php
index 20ed23d..08067b4 100644
--- a/htdocs/save.php
+++ b/htdocs/save.php
@@ -1,15 +1,26 @@
delete($id)) {
+ header('Location: index.php');
+ }
+ // 修改失敗
+ else {
+ header('Location: edit.php?id='.$id);
+ }
+}
// 修改資料
-if (!empty($_POST['id'])) {
+elseif (!empty($_POST['id'])) {
$id = $_POST['id'];
+ $title = $_POST['title'];
+ $content = $_POST['content'];
// 修改成功
if ($db->edit($id, $title, $content)) {
header('Location: view.php?id='.$id);
diff --git a/htdocs/view.php b/htdocs/view.php
index 4a9f535..e5610e4 100644
--- a/htdocs/view.php
+++ b/htdocs/view.php
@@ -33,7 +33,7 @@ $created_at = $item['created_at'];