使用$ mysqli-> insert_id来分配主题以在论坛脚本中发布是安全的吗?

I've a forum script that makes for every new topic a "container" and assign to it each post linked to the topic.

So, when I open a new topic my script makes a new row in forum_topics and a new row in forum_posts.

In forum_posts it put into parent column the id of the topic container.

For know who is the container of the post I'm creating I use:

$mysqli->insert_id

I'd like to know if it is safe, I think to two users who open a new topic at the same time... It is a plausible problem?

Yes it is safe.
Each PHP process uses separate connection and this variable contains inserted id from this very connection