[thelist] MySql Rollback in PHP within a website

bruce bedouglas at earthlink.net
Sun Jul 13 15:34:57 CDT 2003


Hey...

I have a question. I need to be able to try to perform a database update,
but if it doesn't succeed, I need to be able to rollback the changes, and to
inform the user that the changes didn't succeed.

I've looked at the MySql site, and can see somewhat how the Commit/RollBack
functions work. However, I'm not sure how to create the required PHP code to
implement this kind of process...

Basically I need to:

	Create query...
	Perform Update on the table(s)
	Perform my check(s)
	If the checks fail
		alert user
		rollback updates
	else
		success

It's my understanding that I need to somehow set "START TRANSACTION" prior
to beginning the update. But I'm not sure how to do that within the PHP
code... Nor am I sure if there's something else I need to do...

Any examples/hints/sample code will be appreciated. Thanks for any
assistance!

Regards,

Bruce
bedouglas at earthlink.net
(925) 866-2790




More information about the thelist mailing list