Create new_del.php file
We have passed the id of each piece of data in the form of get on the news list page
When we modify the page, we only need to receive this id, and then delete the data in the database
The code is as follows
<?php header("content-type:text/html;charset=utf-8"); $id=$_GET['id']; $conn=mysqli_connect("localhost","root","root","News"); if($conn){ $sql="delete from new where id ='$id' "; $que=mysqli_query($conn,$sql); if($que){ echo"<script>alert('删除成功,返回首页');location.href='new_list.php';</script>"; }else{ echo "<script>alert('删除失败');location='" . $_SERVER['HTTP_REFERER'] . "'</script>"; exit; } }die("数据库连接失败" .mysqli_connect_error()); ?>
This will delete our The function is completed
Combining the previous chapters, we have completed the simplest news release system