X-Git-Url: https://git.jacobcasper.com/?a=blobdiff_plain;f=upload.php;fp=upload.php;h=d69e283ae618bb6718f5149c0fe3a3525a906721;hb=cab93e4b4b26611d59bee711f221e88f4d392dc2;hp=883fa519f8f67eeb7627f4fb85b73c4b7759fec7;hpb=9f2fce357580d713acef37fefa80b289f9f37193;p=pics.git diff --git a/upload.php b/upload.php index 883fa51..d69e283 100644 --- a/upload.php +++ b/upload.php @@ -47,6 +47,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $post_stmt->bindValue(':id', $post_id); $post_stmt->bindValue(':user', $user); $post_stmt->bindValue(':time', $post_time); + + $comment_stmt = $db->prepare('INSERT into comments VALUES (:id, :post_id, :body)'); + $comment_stmt->bindValue(':id', uuid_v4()); + $comment_stmt->bindValue(':post_id', $post_id); + $comment_stmt->bindValue(':body', $_POST['comment'] ?? ''); + $comment_stmt->execute(); $post_stmt->execute(); $db->exec('COMMIT');