Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
is there any database transaction support in PHP?
Old 04-26-2005, 06:39 AM is there any database transaction support in PHP?
Novice Talker

Posts: 12
Trades: 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
jeephp is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-26-2005, 08:09 AM
leavethisplace's Avatar
Ultra Talker

Posts: 297
Trades: 0
im gonna raise my hand and ask what transaction support is

*raises hand*
__________________
A lie gets halfway around the world before the truth has a chance to get its pants on. - Sir Winston Churchill

Please visit my sites:
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
leavethisplace is offline
Reply With Quote
View Public Profile
 
Old 04-26-2005, 08:50 AM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
Why would you need it in php? You can just call mysql_query("START TRANSACTION"); ?

leavethisplace - a transaction is a bunch of queries that all have to happen, or else none should happen. (The operations should be atomic). Think of a bank transferring money between accounts. If it subtracts from one account, but the system crashes or it meets an error condition before it adds to the other, then money disappears. Put them in a transaction and the system can rollback if anything fails.
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Old 04-26-2005, 08:52 AM
Anacrusis's Avatar
Defies a Status

Posts: 2,099
Name: Adam
Location: Colchester CT
Trades: 0
Transactions only work on InnoDB tables within mySql, not the standard myIsam tables. You use transactions with simple SQL statements:
mysql_query("BEGIN");
mysql_query("COMMIT");
mysql_query("ROLLBACK");
Quote:
Originally Posted by leavethisplace
im gonna raise my hand and ask what transaction support is

*raises hand*
When usging transactions and something is done to a database (ie insert, update, or delete), the database server will not make any changes permanent. Every update, insert, and delete statement is logged. This way, you can issue multiple update statements, and if one fails, you can "rollback", or undo all the other updates that happened. If all updates are done successfull, then you can "commit", or make permanant all the updates.

I hope I explained it clearly. If not, do a google search for 'database transactions', there are many tutorials about it.
Anacrusis is offline
Reply With Quote
View Public Profile
 
Old 04-26-2005, 08:53 AM
Anacrusis's Avatar
Defies a Status

Posts: 2,099
Name: Adam
Location: Colchester CT
Trades: 0
Arg, your too quick for me 0beron
Anacrusis is offline
Reply With Quote
View Public Profile
 
Old 04-26-2005, 09:20 AM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
Your syntax is probably more correct!
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Reply     « Reply to is there any database transaction support in PHP?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23613 seconds with 12 queries