# Intermediate Question: Multiple user write a single textfile

**URL:** <https://forum.kirupa.com/t/intermediate-question-multiple-user-write-a-single-textfile/271812>\
**Category:** programming\
**Created:** [September 29, 2008, 3:06am UTC](https://forum.kirupa.com/t/intermediate-question-multiple-user-write-a-single-textfile/271812 "2008-09-29T03:06:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![benghee](https://avatars.discourse-cdn.com/v4/letter/b/9dc877/32.png) [@benghee](https://forum.kirupa.com/u/benghee)\
**Post date:** [September 29, 2008, 3:06am UTC](https://forum.kirupa.com/t/intermediate-question-multiple-user-write-a-single-textfile/271812/1 "2008-09-29T03:06:45Z")

</div>

Hi all,

My php function is like this: [COLOR=red]A user able to add item by using fwrite to create a textfile, and then a code fread this textfile to list out all additional items and if the user confirm the listed items, no any further edit/delete, another set of code will generate the texfile into xml. All the process from create, add, list, edit, delete, sort to generate, i use fwrite, fread, w+ for create textfile and write xml, a+ for append new items to list. A simple flat text database system.[/COLOR]

The code works perfectly but now i want multiple users, instead of just one user, write the textfile at the same time and combine into one xml file. For example, user A and user B log in and create a new listing for different items at the same time in the same directory, thus, 2 .txt file created, but all i need is combine these two or more textfiles and output to one xml files that content different users data.

I hope someone here can help me out this. Many thanks. 🙂
