title: mysql undo query or function
body: <p>Well basically I'm inserting into a relational MySQL database using a MYISAM collation with php.</p>
  
  <p>Lets say a user fills out a web form and posts it for insertion, all the data they provide may belong to parts of several tables.</p>
  
  <p>So using php I'll insert the values into one table, then into another, then into another, etc etc...</p>
  
  <p>But say I insert 3 lots of data into 3 tables, but on the 4th insertion... the sql fails... I then need to return an error message to the user, but ALSO I have to undo all the last inserts.</p>
  
  <p>I could simply just delete all past inserts on fail...</p>
  
  <p>However I wondered if there was an easier way??</p>
  
  <p>Somehow providing the sql queries to mysql engine which temporarily stores the data and SQL, and on command, it runs through all the statements?</p>
  
  <p>Any Ideas?</p>