|
Posted by Gordon Burditt on 10/05/84 11:48
>I'm working on a multi-user system that at times may result in 2 users
>accessing the same screen. These screens allow the users to both view
>and update data. The problem comes when you have user A and user B
>viewing the same screen and user A submits his page that writes to the
>database. User B is now viewing a screen with invalid data. How do I
>prevent this scenario from happening with PHP?
PHP runs server-side. Once user B sees something on his browser,
you can't update the screen again until user B clicks something.
Just about any page displayed on a browser will eventually
become out of date (even one that says who's President of the USA).
You can, however, save all the *OLD* data values in the page (probably
in hidden fields) and when the user submits his update, check that
the values haven't been "changed behind his back" by looking at the
database again and reject or merge such changes. This also prevents
user B from submitting changes, pressing the BACK button, and
submitting the same page again (perhaps with further changes).
Deciding to merge the changes requires careful thought. *Independent*
changes (e.g. one customer service rep changes address, the other
adds a service) could possibly be allowed through.
Gordon L. Burditt
Navigation:
[Reply to this message]
|