我想将INSERT INTO
改为两个不同的MySQL表。例如,
我可以在
中制作吗?$result = mysql_query(
"INSERT INTO tblcustomer(
txtaccount_name,txtfirst_name,txtlast_name,txtemail
,intoffice_no,intfax,intmobile,intother_no,dtebirth_date)
VALUES('$acc_name','$fname','$lname','$email',
'$office','$fax_no','$mobile_no','$others_no','$date')");
$result1 = mysql_query(
"INSERT INTO tbladdress(
txtmailing_add,txtothers_add,txtmailing_street,txtothers_street,
txtmailing_city,txtothers_city,txtmailing_state,txtothers_state,
txtmailing_postcode,txtothers_postcode,txtmailing_country,
txtothers_country)
VALUES('$m_add','$o_add','$m_street','$o_street',
'$m_city','$o_city','$m_state','$o_state',
'$m_postcode','$o_postcode','$m_country',
'$o_country')");
答案 0 :(得分:1)
是的,这可行,但你必须对数据库执行两个查询,我建议使用PDO。它支持交易。
答案 1 :(得分:1)