Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

is there any database transaction support in PHP?

database transaction



12:35 pm on Apr 26, 2005 (gmt 0)

10+ Year Member

I am trying to use database transactions in PHP. I know there is database transaction

support in MySQL but then I was wondering if there is any database transaction support in

PHP (the same way we have in ASP).

Any help.



12:42 pm on Apr 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

hi ranjan,

as of mysql 4 you can send BEGIN, COMMIT and ROLLBACK statements to mysql through php.

if you don't have mysql 4 i suppose you could nest if/else statements in order to catch failures, although i think that could get a bit convoluted.

but i'm not sure what you mean about php itself having transactions?


4:22 pm on Apr 26, 2005 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member

Welcome to WebmasterWorld jeephp

I don't understand your question really

>> database transaction support

well, yeah, that would be the database, has nothing to do with the language per se.

I use php/oracle and use transactions, rollback, commit etc. They seem very supportive of each other. ;)


7:26 pm on Apr 26, 2005 (gmt 0)

10+ Year Member

Try looking at [php.net...] which has commit and rollback functions.


8:32 pm on Apr 26, 2005 (gmt 0)

10+ Year Member

I understand what you mean, but it's much smarter to do this on the database side. With ASP I don't think the ASP is doing the transaction so much as it's sending the proper command to the database system to initiate a transaction.

In PHP, it depends on the database system. With Postgres, for example, it's as simple as doing:




Did you want something other than this?


Featured Threads

Hot Threads This Week

Hot Threads This Month