I have a web application using coldfusion and mysql. There is a form where
customer's payment is entered and submitted. Upon submission customer's
balance is updated. Sometimes customer's balance is updated twice.
How do I prevent this from happening?
Example:
Balance: 1000
payment: 100
After update: balance = 800
Thanks.
MySQL Server
Last Comment
SonnyRey
8/22/2022 - Mon
johanntagle
Without seeing your code, it's hard to make specific suggestions. But one solution is to generate a unique identifier, something like a transaction or order id. When the user clicks submit, the application should check if payment has already been made for this id. If so, then it has found a duplicate payment.
SonnyRey
ASKER
how do you make a unique id? Cannot make a unique id based on time.
johanntagle
You can just use an integer primary key column + auto_increment