You are the right. Is possible use mysql_insert_id() and it need not stack the queries and confirm these one by one. Thanks a lot!! OKi98 wrote: > 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"); > -- Marga Vilalta marga at ayuken dot com Hov ghajbe'bogh ram rur pegh ghajbe'bogh jaj -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php