PHP check if file is in use

Viewed 16465

I want to make a flat files database which will use .php files to store data from the website. My only problem is that if when I 'select' something from the flatfile database (that means the file is read), if in that moment a 'update' is in progress (that means the file is modified and written), the file gets blank and I lose all the content.

I thought about something, to check if the file is in use at the moment, and if it is, to wait a couple of milliseconds and check again.

2 Answers
Related