[PHP-DB] MySQL Transaction

2003-06-17 Thread Becoming Digital
A question was raised on the MySQL list about implementing transactions with
PHP.  I had planned on them for an upcoming project but I'd yet to figure out
how I'd coordinate things.

The original author's solution (slightly altered) was to make an array with all
the queries and loop through them, setting a boolean flag and exiting the loop
if a query fails.  Testing for the value of the flag would execute a commit or
rollback according to its value.

I think this is a decent solution, but I'm wondering what some of you are using.
A search of the Classes Repository yielded only one class, the comments for
which are written in Spanish.  I've included a link below for those who are
interested.
http://promoxy.mirrors.phpclasses.org/browse.html/file/3077.html

Edward Dudlik
Becoming Digital
www.becomingdigital.com




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] MySQL Transaction

2003-06-17 Thread John W. Holmes
Becoming Digital wrote:

A question was raised on the MySQL list about implementing transactions with
PHP.  I had planned on them for an upcoming project but I'd yet to figure out
how I'd coordinate things.
The original author's solution (slightly altered) was to make an array with all
the queries and loop through them, setting a boolean flag and exiting the loop
if a query fails.  Testing for the value of the flag would execute a commit or
rollback according to its value.
Sounds like a good solution to me. Sounds like something that could 
easily be passed to a function with a flag to use a transaction or not 
on the group of queries. Sounds good.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals  www.phparch.com





--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php