Question about API updates to Database

I have a button that either adds (“PUT”) or updates (“PATCH”) a record to a database that I am connected to via an API.

I am looking for the ID of the record and if not found, adds the record to the database. I am finding that I am seeing two records being added and I believe it might be due to the end-user pushing this button a few times in a row and (I am guessing) that the database is not being updated with the new record fast enough to return the ID number, so a new record is being added twice (or sometimes three times).

Is this possible? Can a database return two different results a few seconds apart? Or should I be looking for another reason that two records are being added.

are you making sure the record is being commited (if not it is in a journal file for a few seconds)

Second… make sure on the table that the record ID is the Primary Key , and thne 2nd record should then be rejected… since the PK must be unique

I had a user who clicked a bunch of time (usually 2, but it could have been 3 or…) until I disabled the Add and Update PushButtons at the end of the code.

Of course, it is very hard to create a secure application. (a user error secured free application).

I was thinking of using a Timer but this should work even better. Thanks.

If this is the reason. But doing so will cost only minutes. Remember to enable the PushButtons when the user made changes to the TextFields/TextAreas, after a click in Clears the interface / etc.