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)

New User

10+ Year Member

joined:Apr 23, 2005
votes: 0

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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:July 24, 2002
votes: 0

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

joined:July 24, 2001
votes: 0

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)

Junior Member

10+ Year Member

joined:Feb 29, 2004
votes: 0

Try looking at [php.net...] which has commit and rollback functions.
8:32 pm on Apr 26, 2005 (gmt 0)

Preferred Member

10+ Year Member

joined:Apr 25, 2002
votes: 0

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?


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members