Skip to content

Commit af902f3

Browse files
committed
fghjk
1 parent 1326d0f commit af902f3

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

api/Comment/deleteComment.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,25 @@
2424
$findComment->execute();
2525
$findCommentResult = $findComment->get_result();
2626

27-
$comment = $findCommentResult->fetch_assoc()["Event_ID", "User_ID"] ?? null;
27+
$comment = $findCommentResult->fetch_assoc();
28+
if ($comment) {
29+
$eventID = $comment["Event_ID"];
30+
$userID = $comment["User_ID"];
31+
} else {
32+
echo json_encode(["error" => "Comment not found."]);
33+
exit();
34+
}
2835
$findComment->close();
2936

3037
$deleteComment = $conn->prepare("
3138
DELETE FROM Comments WHERE Comment_ID = ?");
3239
$deleteComment->bind_param("i", $CommentID);
3340
$deleteComment->execute();
3441
$deleteComment->close();
35-
echo json_encode(["comment" => $comment]);
42+
43+
echo json_encode([
44+
"Event_ID" => $eventID,
45+
"User_ID" => $userID,
46+
"success" => true
47+
]);
3648
$conn->close();

0 commit comments

Comments
 (0)