For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > September 2005 > fopen question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author fopen question
paul

2005-09-05, 3:55 am

Hi,

I'm attemptimg to add data to a text file but am worried what happens if
two (or more) click the 'submit' button at the same time. Does fopen()
return a NULL if the file is busy? What would be the best way to do this -
should I put a in sleep(1) and try again in a loop?

Any help appreciated, thanks.

Paul


ZeldorBlat

2005-09-05, 3:55 am

You're really looking for a way to synchronize file access. Check out
flock() :

http://www.php.net/manual/en/function.flock.php

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com