open/read/write to FLAT file - question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
SomeOne
Forum Commoner
Posts: 27
Joined: Tue Jul 25, 2006 2:06 am

open/read/write to FLAT file - question

Post by SomeOne »

i use Flat file = pure txt file, to write some content in it...
everithing ok...though i have a question...
hipotetycli it's possible to hapen...
2 poeple 100% the same time push the "submit" button...
it is posible that the txt file gets empty....
can i prohibit this?
i have read about " Race condition (or race hazard)" and i alsow know i could solve this with "sem_acquire" but this funcion is not instaled on the server of my hosting provider...
so...
is there an alternative? mySQL or any other base is NOT an option!
HELP?! :?
p.s: sorry 4 bad english
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

2 poeple 100% the same time push the "submit" button...
it is posible that the txt file gets empty....
can i prohibit this?
yes and (probably) yes.
Take a look at http://de2.php.net/flock
Post Reply