On 9 Jul 2002 at 22:07, Thomas Edison Jr. wrote: > why the transaction is interrupted, i would like the > transaction to roll back.. that is, all the records > entered before the interruption SHOULD NOT remain in > the database, they should get deleted or something, so > that the transaction can begin Fresh from next time. > > How can i make such a function that will see this > happens, in my PHP/mySQL.
Well be sure that your MySQL supports transactions. InnoDB or something. In perl it's just a case of eval {sql here} if($@ ) {rollback}else commit, the $@ is empty unless the eval created an error. Now, let me see how PHP does this, Google, where are you? http://www.google.com/search?sourceid=navclient&q=mysql+php+rollback Might want to be sure your MySQL supports transactions and is configure appropriately or you can drive yourself nuts. http://www.mysql.com/doc/I/n/InnoDB_transaction_model.html And then some ideas about how to do it with PHP: http://www.php.net/manual/en/ref.mysql.php (wow, right from php.net) http://hotwired.lycos.com/webmonkey/02/11/index4a_page3.html?tw=backend I've never used mysql for anything but a data store so I have no examples myself. Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php