TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Advanced PHP Programming (http://www.talkphp.com/advanced-php-programming/)
-   -   writing to files (http://www.talkphp.com/advanced-php-programming/4966-writing-files.html)

ChrisR 09-24-2009 07:43 AM

writing to files
 
Hello,

I would like to ask about XML and writing to files.

I am making a small database layer that uses .xml files, and was going to update them using put_file_contents().

Then i thought what happens if like 50 people are submitting something like a comment to a post, would it hit the issue of not all the comment been posted? As file_put_content rewrites the files right?

What would be the best why around this. So a lot of people can post stuff and the edit to the file will insert and not have issues. (i want to use this idea of flat file database using xml as mysql is not an option for me)

Salathe 09-24-2009 09:03 AM

Do the comments always have to go into one file; why no make use of the filesystem structure and use many XML files? Also, look into locking files to help prevent the sort of problem you describe.

ChrisR 09-24-2009 10:17 AM

Well thats was just an EG for what i was talking about

I am going to have 1 xml file for accounts that holes account info as well as user groups stuff 1 xml file for other stuff Etc.

If i lock the file what would happen if 3 or so people try to submit some thing at the same time?


All times are GMT. The time now is 06:52 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0