I am working on a project that will collect many traffic on the site, so when a user creates a post, the ID of that inserted post should be available immediately for inserts into another table.
My question is, when there is too much traffic on the site, will inserting a new post conflict in a way that, if user1 inserts a post first and was on a slow network, nearly at the same time but after user1, user2 inserts a post and was on a faster network? With that happening, the user2's post will be the last inserted one, user1 may query the user2's post id as the last inserted post ID.
I don't know the best way to explain this, but I hope someone will understand and help me out.
<?php
$sql = $db_connect->prepare("insert into post(userid,postnum,posttext)values(?,?,?)");
$sql->bind_param("sss",$id,$postnum,$post);
$sql->execute();
$post_id = $sql->insert_id;
?>