Delete messages on PHP development message board
Delete message
## 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 //頁面跳轉(zhuǎn),實(shí)現(xiàn)方式為javascript $url = "list.php"; echo "<script>"; echo "window.location.href='$url'"; echo "</script>"; ?> //使用js頁面跳轉(zhuǎn)回list查看文件的頁面
Key points of this chapter:
- Use the $_GET method to obtain the ID value passed by the address for operation.
- Briefly understand the jump of JS