Question on transaction in mysql
I am making an online shopping cart which is persistent.
On check Out I am taking all the items from shopping cart and looking for the number of quantities ordered for each item and accordingly decrementing the Inventory.
I am looping the whole thing which I described above. i.e I take an item from cart, look for number of items ordered and in very next line I execute an update statement to database.
I want to know if I use transaction ( mysql) then can I do the above thing successfully.
Like before I take anything from shopping cart I will write BEGIN statement. At the end I will make 2 forms one for submit and other for going to previous page which will have commit and rollback statements respectively.
Will this work. I have never used transactions thats why I have a doubt.
Please reply soon

