Good Morning Everyone,
I am making a PHP web frontend for a MySQL database. I have finally started to create the UPDATE portions of the website and am wanting some opinions/feedback as to what I'm trying to do.
Since it is a webpage and not a direct, always connected, link to the database the DBMS will assume an optimistic locking method. I am using InnoDB.
What I am thinking of doing to ensure that concurrent SQL UPDATE statements don't mess with the same record I was going to create hidden form variables of the "old" values and then when the form is submitted compare those "old" values to the ones currently in the database when the submit button is clicked. If they are the same (all of them), then I will allow the UPDATE command to take place. If not, an error message would be thrown.
Is there a better way to handle the situation with concurrent (or someone updating a record in one tab, and thinking they didn't update it in another) updates?
Thanks again!
Kyle
PS. I'm pretty sure this belongs in the MySQL section and not PHP, but please let me know if I'm wrong.