1) Use InnoDB
2) If you cannot use innodb than you can write your code in the way you add
in an array
queries that will rollback the change :

if you do
$r1 = mysql_query('insert into some_table (k1,k2) values (4,2);');
$r1 = mysql_query('insert into some_table (k1,k2) values (5,3);');

you must have in the rollback array this
$rollback_ar = array('DELETE FROM some_table WHERE k1=4 and k2=2;',
'DELETE FROM some_table WHERE k1=5 and k2=3');

Hope this is clear.

Best regards
Andrey Hristov

----- Original Message -----
From: ":B nerdy" <[EMAIL PROTECTED]>
Sent: Wednesday, September 04, 2002 3:04 PM
Subject: [PHP-DB] [mysql] query atomicity

> how would i go about making a few queries into a transaction - that is, if
> one of them fails, the previous queries get rolled back...
> cheers
> --
> PHP Database Mailing List (
> To unsubscribe, visit:

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to