Welcome to WebmasterWorld Guest from 220.127.116.11 , 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 msg:1311349 12:35 pm on Apr 26, 2005 (gmt 0) 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).
jamie msg:1311350 12:42 pm on Apr 26, 2005 (gmt 0)
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?
jatar_k msg:1311351 4:22 pm on Apr 26, 2005 (gmt 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. ;)
jusdrum msg:1311352 7:26 pm on Apr 26, 2005 (gmt 0)
Try looking at [ ...] which has commit and rollback functions. php.net Filipe msg:1311353 8:32 pm on Apr 26, 2005 (gmt 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?