homepage Welcome to WebmasterWorld Guest from 54.226.213.228
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
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).

Any help.

Ranjan

 

jamie




msg:1311350
 12:42 pm on Apr 26, 2005 (gmt 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?

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 [php.net...] which has commit and rollback functions.

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:

pg_query("BEGIN;");

pg_query("ROLLBACK;");

pg_query("COMMIT;");

Did you want something other than this?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved