Welcome to WebmasterWorld Guest from 18.104.22.168 , register , free tools , login , search , pro membership , help , library , announcements , recent posts , open posts Become a Pro Member
is there any database transaction support in PHP? database transaction jeephp
Hi, 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).
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?
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. ;)
Try looking at [ ...] which has commit and rollback functions. php.net Filipe
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?