RE: [PHP] php Transaction question
| From: | Steve Bradwell | Date: | Tue, 20 Aug 2002 14:17:57 +0000 |
| Subject: | RE: [PHP] php Transaction question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-113326@lists.php.net to get a copy of this message | ||
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:icgphp@icecoldgold.com]
Sent: Tuesday, August 20, 2002 10:14 AM
To: php-general@lists.php.net
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