Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: Making credit processing atomic

by RazorbladeBidet (Friar)
on Apr 12, 2005 at 16:37 UTC ( #447084=note: print w/replies, xml ) Need Help??

in reply to Making credit processing atomic

Several things.

You can make your update/insert a transaction. Depending on your database, start the transaction, execute the statments, and commit ONLY if both succeed. Otherwise you have an error.

You can also set flags on the users end to prevent them from refreshing the page. One is to disable any buttons immediately after they are clicked and another is to set cookies to hold flags which are set when the transaction starts. These are only really useful if you REQUIRE the user to have JavaScript and/or Cookies enabled.

Any database error after transaction approval should be a system error and complete rollback. Unless, of course, you want to try again.

Are you also settling the credit card?
"But what of all those sweet words you spoke in private?"
"Oh that's just what we call pillow talk, baby, that's all."

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://447084]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2020-10-29 11:55 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (270 votes). Check out past polls.