marga wrote:

Is not possible to use mysql_insert_id() and assing it in a php variable, 
because
mysql_insert_id() is executed after the COMMIT, I think.
wrong, it is possible to use mysql_insert_id() during the transaction.

the code should look like this:

mysql_query("start transaction");
if (mysql_query(insert into first table)) {
 $id=mysql_insert_id();
 if (!mysql_query(subsequent inserts)) $error=1;
 }
 else $error=1;
mysql_query((isset($error)) ? "rollback" : "commit");

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

Reply via email to