Home > Article > Backend Development > PHP example-php implements comment reply and delete function
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!