作者:L呆头_383 | 来源:互联网 | 2023-05-16 16:37
Ihaveacommentsectiononmyindex.phppage.(likeIhavedisplayedhere)Ihaveadeletelinktha
I have a comment section on my index.php page. (like I have displayed here) I have a delete link that sends you to the delete page. I want to be able to delete that specific ID when it is clicked. index.php
我在index.php页面上有一个评论部分。 (就像我在这里显示的那样)我有一个删除链接,可以将您发送到删除页面。我希望能够在单击时删除该特定ID。的index.php
delete.php page
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "DELETE FROM commenttable WHERE id=id";
if (mysqli_query($conn, $sql)) {
echo "Record deleted successfully";
} else {
echo "Error deleting record: " . mysqli_error($conn);
}
mysqli_close($conn);
?>
every time I send a specific comment there, it deletes all the comments. I know it's because I'm not stating which ID to select, but i'm having a hard time figuring that out.
每当我在那里发送特定评论时,它都会删除所有评论。我知道这是因为我没有说明选择哪个ID,但我很难搞清楚。
Thanks for any help!
谢谢你的帮助!
1 个解决方案
".$row['id']."
".$row['user'].":
".$row['usercomment']."
".$row['timestamp']."
Delete