亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

PHP development article publishing system backend article modification handler

The article modification processing program flow chart is roughly as follows:

文章修改處理程序.png

##The code is as follows

<?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>";
	}
?>


# Code comments

    Connect to the database
  • Get the value passed by the post method of modifying the page, and the time is obtained by timestamp
  • Execute the modification statement. If it succeeds, it will prompt that the modification is successful and jump to the background article management page. If it fails, it will prompt that the article modification failed and jump to the article management page.

Continuing Learning
||
<?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>"; } ?>
submitReset Code