Detailed explanation of how to implement comment reply and delete function in PHP

*文
Release: 2023-03-19 07:26:02
Original
3111 people have browsed it

How to implement comment reply and delete function in PHP? This article mainly introduces the comment reply and delete function in PHP in detail. It has certain reference value. Interested friends can refer to it. I hope to be helpful.

Simple comment reply and delete function, the specific content is as follows

1. Database

Create two tables, one is the pinglun table; the other is 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]}

"; } } ?>
Copy after login

2. Comment processing page pinglunchuli.php

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

3. Reply processing page huifuchuli.php

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

4. Delete processing Page delchuli.php

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

Related recommendations:

thinkphp5 method of uploading images and generating thumbnails

Detailed explanation of how PHP implements a simple search box automatic prompt function

Detailed explanation of how PHP obtains the audio file duration

The above is the detailed content of Detailed explanation of how to implement comment reply and delete function in PHP. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!