Intanto devi per forza utilizzare delle tabelle che supportano le transazioni (accertati che la tua versione di mysql le supporti), io ti consiglio le INNODB
poi puoi usare questa classe (l'ho fatta io in PHP 4 e potrebbero esserci alcune cavolate)

codice:
class dbTransaction{
	var $status;
	var $snapshot;
	/*il costrutture di questa classe disabilita automaticamente l'autocommit del DB 
	* per riabilitarlo chiamare il metodo setAtoCommit() con parametro impostato a 1*/
	function dbTransaction(){
		$this->status = "EXECUTE";
		$this->snapshot = false;
		$this->setAutoCommit(0);
	}
	function beginTransaction($snapshot = 0){
		if($snapshot == 1){
			$snap = " WITH CONSISTENT SNAPSHOT";
			$this->snapshot = true;
		}else{
			$snap = "";
			$this->snapshot = true;
		}
		$start = "START TRANSACTION".$snap;
		mysql_query($start);
	}
	function commit(){
		mysql_query("COMMIT");
		$this->status = "COMMIT";
	}
	function rollback(){
		mysql_query("ROLLBACK");
		$this->status = "ROLLBACK";
	}
	function setAutoCommit($value = 1){		//default disabled
		if(is_numeric($value)){
			if($value == 0 || $value == 1){
				($value == 0)?($this->commitStat = "MANUAL"): ($this->commitStat = "AUTO");
				$autoCommit = "SET AUTOCOMMIT = ".$value.";";
				mysql_query($autoCommit) or die(mysql_error());
			}else{
				echo "Il valore inserito non e' corretto";
				exit();
			}
		}else{
			echo "Il valore inserito non e' corretto";
			exit();
		}
	}//END setAutoCommit
}
Per documentarti puoi andare qui:

http://dev.mysql.com/doc/mysql/en/commit.html

Per ulteriori dubbi e perplessita' posta pure