467,915 Members | 1,628 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,915 developers. It's quick & easy.

data access btw: Merry Christmas!

Merry Christmas!

I'm looking at doing a web application using xml/xhtml/xforms and php. I think the data files will not be huge so i don't want to use MySQL database, I'll just append the data to the appropriate xml files.

My question is, suppose I have a form that submits and appends the results to an xml file via php. What if several people are doing the form at the same time and several submit at the same time (think of students taking an online exam). Will php automatically handle that? I'm assuming that there is no such thing as simultaneous submissions, as there should be at least milliseconds of difference between each submission. Will php take them one at a time without overwriting or freezing up or something?
Dec 24 '06 #1
  • viewed: 1183
Share:
2 Replies
ronverdonk
Expert 4TB
You will need to lock the file before using it. The flock() provides that function, HOWEVER, only if ALL file accessing functions for that file use flock(). Also, there are exceptions to the usage of flock(). Best is to see the PHP documentation for an explanation and some samples on locking, at http://nl3.php.net/manual/en/function.flock.php

Ronald :cool:
Dec 24 '06 #2
Thanks Ronald
Your reference helped me to clarify my question.

I won't be using several different files or functions to access a single file to append to.

Let's say I have several students accessing one form, test.xhtml (with xforms). After answering all the questions they'll submit via post to accept_answers.php. Then accept_answers.php will accept the data; open answers.xml; append the data to answers.xml; close answers.xml, and then move on to the next request.

In this situation will the http protocol (server) automatically line the users up and let them wait while it processes one submission at a time, or would even this situation still produce some kind of conflict?
Dec 27 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by T. Wintershoven | last post: by
1 post views Thread by Alex Hardin | last post: by
5 posts views Thread by manuhack | last post: by
14 posts views Thread by Susan Rice | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.