Following the spirit of atomic operations, I found a link on starting and ending a transaction.
http://stackoverflow.com/questions/12091971/how-to-start-and-end-transaction-in-mysqli
And this might be a good link for figuring out where to place the commit statement when using prepared statements.