You can control the behavior of transaction by setting the session variable called AUTOCOMMIT.
if AUTOCOMMIT is set to 1(the default),then each SQL statment(within a transaction or not) is
considered to be a complete transaction and committed by default finishes.
When AUTOCOMMIT is set to 0,by issuing the SET AUTOCOMMIT=0 command, the subsequent series of statements acts like a transaction, and no activities are committed until and explicit COMMIT statement is issued
You can execute these SQL commands in php using mysql_query() function.