niche Posted January 7, 2010 Share Posted January 7, 2010 I have developed a with Php and Mysql. As more people are working on it simultaneously, there is the danger that two users have the same form on the screen, and one user changes fields, while the other is then working on old information.When this latter submits, he will destroy the changes that the first user made. Is there a neat way to prevent this? Blocking certain pages, making a warning? How does that work in PHP and/or Mysql?Thank-you. Link to comment Share on other sites More sharing options...
justsomeguy Posted January 7, 2010 Share Posted January 7, 2010 You can keep track of the last time each field was updated, and whenever someone loads the page you can record the time they loaded. When they submit the page you can compare the time they loaded the page with the time the fields were updated so that you'll know if the fields got updated since they loaded the page. Link to comment Share on other sites More sharing options...
boen_robot Posted January 7, 2010 Share Posted January 7, 2010 The best I can think of is using Ajax in a "chat-like" form (or "Google Wave"-like form). Simply ping the server every second or so, and update the form if the field has changed. You won't even need a save button in this case. Other than that... I don't know. Link to comment Share on other sites More sharing options...
niche Posted January 7, 2010 Author Share Posted January 7, 2010 What about PHP Sessions, are they more trouble than they're worth? Link to comment Share on other sites More sharing options...
jeffman Posted January 7, 2010 Share Posted January 7, 2010 Considering what they do, PHP sessions are no trouble at all. Link to comment Share on other sites More sharing options...
justsomeguy Posted January 7, 2010 Share Posted January 7, 2010 The session is one place where you can store the time they loaded the page. Link to comment Share on other sites More sharing options...
niche Posted January 7, 2010 Author Share Posted January 7, 2010 I've been doing some quick reading about PHP Sessions. How do I return the UID, or will I not have the need to know the UID for someone's session? Link to comment Share on other sites More sharing options...
justsomeguy Posted January 7, 2010 Share Posted January 7, 2010 You can set any session variables you want, if you want to store the user ID you can. The session array is just a normal array, you can read and write to it like any other. Link to comment Share on other sites More sharing options...
niche Posted January 7, 2010 Author Share Posted January 7, 2010 Many thanks to justsomeguy, boen_robot, and Deirdre's Dad. You all helped me very much. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now