我有以下插入语句:
$sql ="INSERT INTO `firm`(name, VAT, active) VALUES ('$name', '$VAT', '$active')";
$sql = "INSERT INTO `area`(name, hub_name, fk_hub_id) VALUES ('$areaname',(SELECT `name` from hub WHERE name = '$hub_name'), (SELECT `id` from hub WHERE name = '$hub_name'))";
$sql ="INSERT INTO 'contactdetails'
(fk_firm_id,
address_physical_line_1,
address_physical_line_2,
address_physical_line_3,
address_physical_line_4,
address_physical_line_5,
address_physical_line_6,
address_physical_line_7,
address_physical_code,
address_postal_line_1,
address_postal_line_2,
address_postal_line_3,
address_postal_line_4,
address_postal_line_5,
address_postal_line_6,
address_postal_line_7,
address_postal_code,
fax_1,
fax_2,
phone_1,
phone_2,
phone_3,
phone_4)
VALUES ( (SELECT `id`
FROM firm
WHERE name = '$name'),
'$address_physical_line_1',
'$address_physical_line_2',
'$address_physical_line_3',
'$address_physical_line_4',
'$address_physical_line_5',
'$address_physical_line_6',
'$address_physical_line_7',
'$address_physical_code',
'$address_postal_line_1',
'$address_postal_line_2',
'$address_postal_line_3',
'$address_postal_line_4',
'$address_postal_line_5',
'$address_postal_line_6',
'$address_postal_line_7',
'$address_postal_code',
'$fax_1',
'$fax_2',
'$phone_1',
'$phone_2',
'$phone_3',
'$phone_4') ";
我是否必须使用事务语句来运行这三个查询。我从未使用过事务性报表。一个语句取决于其他语句的值。