# "changing xml-file using php"-problem

**URL:** <https://forum.kirupa.com/t/changing-xml-file-using-php-problem/57443>\
**Category:** programming\
**Created:** [July 13, 2004, 10:22am UTC](https://forum.kirupa.com/t/changing-xml-file-using-php-problem/57443 "2004-07-13T10:22:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Seticus](https://avatars.discourse-cdn.com/v4/letter/s/46a35a/32.png) [@Seticus](https://forum.kirupa.com/u/Seticus)\
**Post date:** [July 13, 2004, 10:22am UTC](https://forum.kirupa.com/t/changing-xml-file-using-php-problem/57443/1 "2004-07-13T10:22:19Z")

</div>

I’m combining flash, php and xml to make an online game. When you play the game and enter a room, you load a php-script that gets data from the swf and then rewrites a xml-file.

The problem is that when two users call the php script somewhat at the same time, one of them will not be recorded because the other will overwrite the file with the adapted old file.

Are there any ways around this? I don’t think you can change an xml file (using php) without rewriting it, is it possible to change for instance the value of an attribute?

Hope I’m making sence.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 16, 2004, 5:32am UTC](https://forum.kirupa.com/t/changing-xml-file-using-php-problem/57443/2 "2004-07-16T05:32:47Z")

</div>

create a new file for each user, ? or temp file… (php aint got nothign to do with it. )

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 16, 2004, 9:16am UTC](https://forum.kirupa.com/t/changing-xml-file-using-php-problem/57443/3 "2004-07-16T09:16:36Z")

</div>

That’s a good idea, but then I’d have to make a script that reads 500 text-files at the same time and i’m affraid that will slow it down. A temporary file sounds good, but how does it work?
