PHP development...LOGIN

PHP development news release system news deletion page

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

<a href="new_del.php?id=<?php echo $row['id']?>">Delete</a>

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

    $sql="delete from new where id ='$id' ";
        echo "<script>alert('删除失败');location='" . $_SERVER['HTTP_REFERER'] . "'</script>";
}die("数据库连接失败" .mysqli_connect_error());

This will delete our The function is completed

Combining the previous chapters, we have completed the simplest news release system

<?php header("content-type:text/html;charset=utf-8"); $conn=mysqli_connect("localhost","root","root","News"); $id=$_GET['id']; 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()); ?>
submitReset Code