Results 1 to 7 of 7
Thread: It Happened To Me...
Oct 26, 2009, 05:48 #1
- Join Date
- Oct 2006
- Queensland, Australia
- 0 Post(s)
- 0 Thread(s)
It Happened To Me...
Do you know how there's that small possibility between when you insert a row, and when you insert another row using LAST_INSERT_ID(), that another insert statement that's part of another action, will be executed somewhere in between the two aforementioned queries? Well, it finally happened with an eCommerce site I created a year and a half ago.
During the processing of a order and credit card transaction, another order and credit card transaction had also began processing. What happened was the wrong order_id was given to one of the credit card transactions. Fortunately, as 'noob' as I may have been back then, I made sure that if this were to occur, it wouldn't be disastrous. Luckily the only thing it affected was the display of the credit card transaction information. The actual payment had been applied to both orders correctly.
By the way, this website only gets about 20 orders a day at the most, and my log confirms that both orders were placed within the same second. There would have only been a milliseconds in it.
This is just a warning to all those who think it's too rare of an occurrence for this to happen to one of their websites or applications.
Feel free to share any similar experiences you've had, so we can all learn from others mistakes and poor practices.