prepared comment counting

This commit is contained in:
luptmoor
2026-04-28 10:04:51 +02:00
parent d0bba3d3f8
commit 02ba53724e
2 changed files with 9 additions and 0 deletions

View File

@@ -629,6 +629,14 @@ function handle_create_comment($input) {
':content' => $input['content']
]);
$stmt2 = $pdo->prepare("
UPDATE contributions
SET comment_count = comment_count + 1
WHERE id = :cid;
");
$stmt2->execute([':cid' => $input['contribution_id']]);
json_response([
'message' => 'Comment created successfully.',
'comment_id' => (int) $pdo->lastInsertId()