Ya that's pretty much it. Just do:

mysql_query("BEGIN");
$sql = "Update bla...";
$result = mysql_query($sql);
if($result)
 mysql_query("COMMIT");
else
 mysql_query("ROLLBACK");

HTH
Steve.

-----Original Message-----
From: Randy Johnson [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 20, 2002 10:14 AM
To: [EMAIL PROTECTED]
Subject: [PHP] php Transaction question


I know I saw this somewhere before but cannot find the answer

In a php/mysql script  how do a do a transaction

is it like this or is their a better way to do it? 

innodb table method

$query="set autocommitt=0;"
mysql_query($query);

$query="select blah from blah;";
mysql_query($query);

$query="update blah where blah;";
mysql_query($query);

$query="committ;";
mysql_query($query);


Thanks

Randy



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to