I want to make a flat files database wich 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 readed), if in that moment a 'update' is in progress (that means the file is modified and written), the file gets blank and I loose all the content.
I thaught 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.
look into
flock()
http://php.net/manual/en/function.flock.phpPlease Try this It worked on my case....