Codice PHP:
@mysql_query("BEGIN");
$query = "INSERT INTO principal_table (nome,cognome,codicefiscale,indirizzo,citta,provincia,cap,nazione,telefono,fax,email,fattura,categoria_a,cod_iva,int_fattura,indirizzo_fattura,indirizzo_int,citta_int,provincia_int,cap_int,nazione_int,mod_pagamento,prezzo,stato_pagamento,data,conferma,movimenta,iva)
VALUES (\"$resul_nome\",\"$resul_cognome\",\"$resul_codicefiscale\",\"$resul_indirizzo\",\"$resul_citta\",\"$resul_provincia\",\"$resul_cap\",\"$resul_nazione\",\"$resul_telefono\",\"$resul_fax\",\"$resul_email\",\"$resul_fattura\",\"$resul_categoria_a\",\"$resul_cod_iva\",\"$resul_int_fattura\",\"$resul_indirizzo_fattura\",\"$resul_indirizzo_int\",\"$resul_citta_int\",\"$resul_provincia_int\",\"$resul_cap_int\",\"$resul_nazione_int\",\"$resul_mod_pagamento\",\"$costi\",\"$stato_error\",now(),\"$conferma\",\"$movimenta\",\"$iva\")";
$insert = mysql_query($query, $conn);
$id = mysql_insert_id($conn);
$query_events = "INSERT INTO elements_eventi (evento_id, email, cena_gala, costo_gala, evento_sociale, costo_evento, serv_navetta, costo_navetta, totale, visti)
VALUES (\"$id\",\"$resul_email\",\"{$_SESSION['cena_gala']}\",\"{$_SESSION['costo_gala']}\",\"{$_SESSION['evento_sociale']}\",\"{$_SESSION['costo_evento']}\",\"{$_SESSION['serv_navetta']}\",\"{$_SESSION['costo_navetta']}\",\"$totale_eventi\",\"$visti\")";
$insert_events = mysql_query($query_events, $conn);
if($insert && $insert_events)
{
@mysql_query("COMMIT");
}
else
{
@mysql_query("ROLLBACK");
}