0
I have an application in which two users can update an item in the database, however I kept thinking about the following situation:
If they click to sync at the same instant, including time/minutes/seconds you can subscribe to each other’s update or there would be some problem (this in my head).
To solve this I thought of using thousandths of seconds, in this case the probability would be even less, but as they say, lightning does not fall in the same place, but it will fall. At the moment I am using this way to get the current time of synchronization:
$date_sync = time();
$date_sync = date('Y/m/d H:i:s', $date_sync);
I know that there are several ways in which I can solve this problem, but I am not quite sure which one would be the most viable. Could someone give me a suggestion?!
In fact it is the opposite, lightning tends to fall always in the same place (happened to the mother-in-law of a friend of ours included). The autonumbering of DB serves to avoid this kind of thing, you can conjugate the time and the generated ID, (or use only the ID) for unique identification. If it is a change to the same DB item, you need some other type of control (do not delete the record or write over it, but add a new one that replaces the previous one)
– Bacco
Because the ray goes down the path of least resistance, it tends to be repetitive: https://www.youtube.com/watch?v=M6azrJq6V5Q - although out of the DB problem, I think the analogy is worth something that depends on "luck" :)
– Bacco
@Bacco thought I’d do it in a way like this, it would simplify my situation. heuhe. I think I’ll create another table then for control.
– viana