data access btw: Merry Christmas!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ClarkePeters
    New Member
    • Dec 2006
    • 14

    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?
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    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:

    Comment

    • ClarkePeters
      New Member
      • Dec 2006
      • 14

      #3
      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?

      Comment

      Working...