Delete messages...LOGIN

Delete messages on PHP development message board

Delete message

QQ截图20161130143431.png

## Create the file del.php

<?php
include 'conn.php';
    $id = $_GET['id'];
    $query="delete from message where id=".$id;
    mysql_query($query);
?>
//引入conn文件,使用get方式获取id,使用sql语句来删除id
<?php
//页面跳转,实现方式为javascript 
$url = "list.php";
echo "<script>";
echo "window.location.href='$url'";
echo "</script>";
?> 
//使用js页面跳转回list查看文件的页面


Key points of this chapter:

  1. Use the $_GET method to obtain the ID value passed by the address for operation.


  2. Briefly understand the jump of JS


  3. Next Section
<?php include 'conn.php'; $id = $_GET['id']; $query="delete from message where id=".$id; mysql_query($query); ?> //引入conn文件,使用get方式获取id,使用sql语句来删除id <?php //页面跳转,实现方式为javascript $url = "list.php"; echo "<script>"; echo "window.location.href='$url'"; echo "</script>"; ?>
submitReset Code
ChapterCourseware