Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Making credit processing atomic

by RazorbladeBidet (Friar)
on Apr 12, 2005 at 16:37 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-25 15:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found