What is the best way to do more than one sql query with prepared statement?

With prepared statement, what is the best way to do more than one query? Can I just continue with the next query inside the current query or must this be done outside any closing {}? Can i do the following?


$sql = "INSERT INTO posts (category_id, topic_id, post_creator, post_content, post_date) VALUES (?,?,?,?,?);";

		if (!mysqli_stmt_prepare($stmt, $sql)) {
				   echo 'SQL error';
				   
				} else {
				    mysqli_stmt_bind_param($stmt, "iisss", $cid, $tid, $creator, $reply_content, $date);
				    mysqli_stmt_execute($stmt);

				

				    $sql2 = "UPDATE categories
                             SET last_post_date = ?, last_user_posted = ?
                             WHERE id = ?
                             LIMIT ?
				             ";
or should it be this?

$sql = "INSERT INTO posts (category_id, topic_id, post_creator, post_content, post_date) VALUES (?,?,?,?,?);";

		if (!mysqli_stmt_prepare($stmt, $sql)) {
				   echo 'SQL error';
				   
				} else {
				    mysqli_stmt_bind_param($stmt, "iisss", $cid, $tid, $creator, $reply_content, $date);
				    mysqli_stmt_execute($stmt);
                         }
}
				

				    $sql2 = "UPDATE categories
                             SET last_post_date = ?, last_user_posted = ?
                             WHERE id = ?
                             LIMIT ?
				             ";

The bottom one has some closed braces