TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 09-24-2009, 07:43 AM   #1 (permalink)
The Wanderer
 
Join Date: Dec 2008
Posts: 16
Thanks: 2
ChrisR is on a distinguished road
Default 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)
ChrisR is offline  
Reply With Quote
Old 09-24-2009, 09:03 AM   #2 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

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.
Salathe is offline  
Reply With Quote
Old 09-24-2009, 10:17 AM   #3 (permalink)
The Wanderer
 
Join Date: Dec 2008
Posts: 16
Thanks: 2
ChrisR is on a distinguished road
Default

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?
ChrisR is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to protect your php files & database if PHP fails! Sam Granger Tips & Tricks 5 02-18-2012 08:07 PM
How to mail files as attachments? sandhyagupta Absolute Beginners 2 07-21-2009 04:14 PM
Retrieving Files from a Backup in Vista CMellor The Lounge 2 06-24-2008 02:34 PM
Notepage like application to open large MySQL files Wildhoney General 6 12-07-2007 02:18 PM
Uploading Files with PHP daz Absolute Beginners 3 09-30-2007 06:23 PM


All times are GMT. The time now is 01:01 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design