sprintf()问题,似乎不是语法错误

I'm trying to make a public forum with a reply section for each question. Previously, when I wrote some code to allow the user to add questions for each category/subject, my sprintf() code didn't seem to have any issues.

However, now that I'm trying to code my replies section, there are no outright errors, but it just doesn't seem to work.

Because I'm trying to save the reply content and replying user, as well as coordinating it with the topic of the post, I have 3 parts to my sprintf() code. I tried splitting up the sprintf() and treating all 3 parts separately, but they all seem to have issues.

Here's my code:

fyi, comment_message is the name of the input textbox for the comment; topicid is the id of the page, and links to the id of the topic the post is under; post_by represents which user is posting the comment

if ($_SERVER['REQUEST_METHOD'] == 'POST') {

                    $postContent = mysqli_real_escape_string($conn, $_POST['comment_message']);

                    $sql = sprintf("INSERT INTO posts (post_content, post_topic, post_by)
                        VALUES('%s', %s, %s);", $postContent, $topicid, $_SESSION['userId']);

                    $result = mysqli_query($conn, $sql);

                    if(!$result)
                    {
                        //something went wrong, display the error
                        echo 'An error occured while inserting your post. Please try again later.';
                        $sql = "ROLLBACK;";
                        $result = mysqli_query($conn, $sql);
                    }
                    else
                    {

                        $sql = "COMMIT;";
                        $result = mysqli_query($conn, $sql);
                        echo 'Success!';

                    }
                }

I appreciate any and all help! Thanks!!