0

I need a suggestion on how to implement this condition: I have a system where there are admins that can edit student/user profiles, but my problem is I have multiple admins that is editing those profiles so what I dont want to happen is 2 or more admins are editing one specific profile at the same time. I am only familiar to javascript and a little in jquery and ajax.

my current solution in this has a flaws and limit where my condition is, whenever the admin clicks a profile it will trigger a status into the database that will update the column for currently_open profile into "Yes" so the other admins cant open the same profile anymore and for the admin that is currently editing the profile, the only way to trigger the status of the user is to click the save or submit button to update the database column currently_open into "No".

Well the problem of this method is whenever the browser is closed, refreshed, session time out or connection lost. the status will remain open and even the last admin that is editing the profile wont be able to access it anymore.

Vince Osana
  • 416
  • 1
  • 5
  • 22
  • what about column like current_editing_admin_id with ID of admin, which is editing the profile? – zdeniiik Sep 14 '17 at 06:50
  • 1
    https://stackoverflow.com/questions/25805298/how-to-prevent-two-user-edit-same-content-at-same-time And https://stackoverflow.com/questions/9795742/what-is-the-best-method-to-make-sure-two-people-dont-edit-the-same-row-on-my-we – Alive to die - Anant Sep 14 '17 at 06:50
  • Get the `UpdatedDate` to the client while loading the data. Before updating, check if the `UpdatedDate` in the database for the record is same as the one submitted from the form. If they are same, go ahead with the save. Otherwise show a message in the browser: "Record already changed, please refresh" – adiga Sep 14 '17 at 07:05

0 Answers0