phpmysqlicodeigniter-3grocery-crud

How to restrict database modification when two users are working on the same record - groceryCRUD


I am writing an app using Codeigniter/groceryCRUD.

How can I restrict two users to work on the same field at the same time ?

EDIT

I have tried when two users work simultaneously. The first user can not see modifications made by the second user, but his modifications remain visible to him; the second user too can see only his modifications.. while in the database, the most recent user modifications take effect. That's not a good practice.


Solution

  • One solution could be to lock each table when a user is accessing it by keeping a table of accessed tables in the database.

    When the user exits the view, all tables locked by that user ID will be freed again.