I have this situation when there are 2 users A and B and they send friend request simultaneously to each other for adding as friend. The data model to support this relationship has columns inviter_id and friend_id and a status.
Since both of them sent request to each other together, I am facing problem in deciding who should be stored as Initiator of request as data may get dirty in database with both as initiator of same relationship since they happened absolutely concurrent.
In other languages , there are construct for Locks which can handle this by putting one to wait while other is served. I don't know how to implement this in PHP and Apache .. please advice on this..