Home  >  Article  >  Backend Development  >  PHP example-php implements comment reply and delete function

PHP example-php implements comment reply and delete function

微波
微波Original
2017-06-28 13:13:083167browse

This article mainly introduces the comment reply in php in detail. Delete function has a certain reference value. Interested friends can refer to

Simple comment reply Delete function, the specific content is as follows

1. Database

Create 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


无标题文档
 
 
 

朋友圈

内容:

今天很嗨


query($sql,1); foreach($arr as $v) { echo"

{$v[1]} {$v[3]}

{$v[2]}

//删除按钮
//回复按钮
"; $dc = new DBDA(); $sql1 ="select * from huifu where jieshouid ={$v[0]}"; //查询回复表中的id和传过去的id是不是一样的 $arr1 = $dc->query($sql1,1); foreach($arr1 as $k) { echo "

{$k[2]} {$k[3]}

{$k[4]}

"; } } ?>

2. Comment processing page pinglunchuli.php

query($sql);
header("location:main.php");

3. Reply processing page huifuchuli.php

query($sql);
header("location:main.php");

4. Delete processing page delchuli.php

query($sql))
{
 
  header("location:main.php");
}
else
{
  echo "删除失败!";
}

The above is the detailed content of PHP example-php implements comment reply and delete function. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn