title: Can MySQL transaction rollback without ROLLBACK query?
body: <p>I'm working on a financial system and I've got a problem with the MySQL transactions.</p>
  
  <p>The system is a simple stock exchange, where users can buy and sell virtual shares. To keep integrity in buy and sell process I use transactions.
  The problem is that in some cases (I don't know what it depends on) some of transactions are rolled back (or not commited), but next queries are processed.</p>
  
  <p>The process is following:</p>
  
  <ol>
  <li>User wants to buy shares for 1000 USD</li>
  <li>In orderbook there are 4 offers for 250 USD </li>
  <li><code>START TRANSACTION</code></li>
  <li>For every offer:</li>
  <li>Script does a UPDATE query (moving USD from one user to another and shares in the opposite way). Then script INSERTs entries to history tables. </li>
  <li>Users pay a fee (UPDATE balances).</li>
  <li>Repeat 5 and 6 for the next offer.</li>
  <li><code>COMMIT</code></li>
  </ol>
  
  <p>Now the key part - in some cases changes from point 5 are not saved, but from the 6 they are (I see that fee was paid, but there is no transaction in the history).
  I'm not using <code>ROLLBACK</code> during this transactions and the script is not breaking (because in this case fee wouldn't be paid).</p>
  
  <p>Is there any possibility that transaction is rolling back without <code>ROLLBACK</code> query? Or can MySQL COMMIT only few newest queries instead of all?</p>