Locking a text file database using php
Locking a text file database using php
Usually while using plain text as database we need to take care of lot of things.In that the main point to be always noted is if one request is using the text DB then we need to wait for that request to complete and then move ahead to process the next, otherwise data loss may happen.
Why DATA LOSS happens?
The text db is not having that intelligence to queue up the request and process it one by one,
So here we can use FLOCK in php to prevent that data loss.
I always recommend my users to use MYSQL as the database if your website has more traffic.