We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1326d0f commit af902f3Copy full SHA for af902f3
1 file changed
api/Comment/deleteComment.php
@@ -24,13 +24,25 @@
24
$findComment->execute();
25
$findCommentResult = $findComment->get_result();
26
27
-$comment = $findCommentResult->fetch_assoc()["Event_ID", "User_ID"] ?? null;
+$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
+}
35
$findComment->close();
36
37
$deleteComment = $conn->prepare("
38
DELETE FROM Comments WHERE Comment_ID = ?");
39
$deleteComment->bind_param("i", $CommentID);
40
$deleteComment->execute();
41
$deleteComment->close();
-echo json_encode(["comment" => $comment]);
42
+
43
+echo json_encode([
44
+ "Event_ID" => $eventID,
45
+ "User_ID" => $userID,
46
+ "success" => true
47
+]);
48
$conn->close();
0 commit comments