PHP開發文章發布系統之後台文章修改處理程序
文章修改處理程序流程圖大致如下:
程式碼如下
<?php require_once('../connect.php'); $id = $_POST['id']; $title = $_POST['title']; $author = $_POST['author']; $description = $_POST['description']; $content = $_POST['content']; $dateline = time(); $sql = "update article set title='$title',author='$author',description='$description',content='$content',dateline=$dateline where id=$id"; if(mysqli_query($conn,$sql)){ echo "<script>alert('修改文章成功');window.location.href='admin_manage.php';</script>"; }else{ echo "<script>alert('修改文章失败');window.location.href='aadmin_manage.php';</script>"; } ?>
#程式碼註解
- 連接資料庫
- 取得修改頁面post方式傳遞過來的值,時間用時間戳記方式取得