This article is mainly for everyone to introduce the PHP implementation of the comment reply delete function, with a certain reference value, interested in small partners can refer to
Simple comment reply Delete function, the specific content is as follows
First, the database
Establish two tables, one is the Pinglun table, the other is the Huifu table
The effect is as follows:
The code is as follows:
1. Main Page main.php
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "><title> Untitled document </title>
2. Comment Processing page pinglunchuli.php
<?php$zhangsan = $_post["Zhangsan"]; $content = $_post["Content"; $time = Date ("y-m-d h:i:s"); Require "DBDA.class.php"; $db = new Dbda (); $sql = "INSERT into Pinglun values (', ' {$zhangsan} ', ' {$content} ', ' {$time} ')"; $db->query ($sql); Header ("location:main.php");
3. Reply Processing page huifuchuli.php
<!--? Php$id = $_get["id"]; Pass the comment ID of the click reply $comment = $_post["Comment"]; Reply to content in text field $me = "Me"; Here is a definition of a person $times = Date ("y-m-d h:i:s"); Require "DBDA.class.php"; $db = new Dbda (); $sql = "INSERT into Huifu values (', ' {$id} ', ' {$me} ', ' {$Times} ', ' {$Comment} ')" ; $db--->query ($sql); Header ("location:main.php");
4. Delete Processing page delchuli.php
<?php$id = $_get["id"];require "DBDA.class.php"; $db = new Dbda (); $sql = " Delete from Pinglun where id= ' {$id} ' ", if ($db->query ($sql)) {header (" location:main.php ");} else{echo "Delete failed! ";}