I save data which come from a form to a file. There is a row number in file. If two or more users submit the form at same time, we expect the row numbers are same. Because before the saving, I read the highest row number for decide new record row number.
How can I prevent that?
sys_getloadavg is solution?
Thanks.
You can do this with a file lock (slow but works on all platforms) or a semaphore. see this thread for details:
PHP mutual exclusion (mutex)