我有一个可以使用 fetch 数组显示结果的页面。因为我在NINS-LEC
页面中添加了一个字段列,所以我很难从另一个数据库表中保存它。我怎么解决这个问题?
<html>
<head>
</head>
<body>
<?php
$server = mysql_connect("localhost","root", "");
$db = mysql_select_db("bsswebtool",$server);
$query = mysql_query("select * from soa where InvoiceAccNum in
('7000068191',
'7000068205',
'7000068060',
'7000068094',
'7000068078',
'7000068086',
'7000068311',
'7000068019',
'7000068299')");
$num_rows = mysql_num_rows($query);
?>
<table class="striped">
<tr class="header">
<td>Groupings</td>
<td>InvoiceAccNum</td>
<td>AccountFirstName</td>
<td>SubsidiaryCode</td>
<td>HandlingCode</td>
</tr>
<?php
while ($row = mysql_fetch_array($query)) {
echo "<tr>";
echo "<td>".'NINS_LEC'."</td>"; //change group name
echo "<td>".$row['InvoiceAccNum']."</td>";
echo "<td>".$row['AccountFirstName']."</td>";
echo "<td>".$row['SubsidiaryCode']."</td>";
echo "<td>".$row['HandlingCode']."</td>";
echo "</tr>";
}
?>
</table>
<?echo "$num_rows Rows\n";?>
<? echo
"<fieldset>
<table width='680'><tr>
<td colspan='4' align='center'>
<input type='submit' name='btn_save' value='Save'>
</td></tr></table></fieldset></form>";
}?>
</body>
这是我将其保存到新表的代码 $query_insert_outbound = "INSERT INTO NINS_LEC (rid,invoiceno,grouping,Address,Subscribercode,AccountTitle,AccountFirstName,InvoiceAccNum,InvoiceNumber,HandlingCode,SubsidiaryCode,LastBillBal,CurrentCharges,TotalDueAmt,Rental_othrC,VatTag, UsageTag,OctTag,BalanceCarryFwd,PaymentReceived,Adjustments,Current,Over30days,Over60days,Over90days,Over120Days,CreditLimit,WithoutTaxTag,InvoiceCurrency,ExchangeRate,AsOnDate) values('','$invoiceno', '$grouping', '$Address' , '$Subscribercode', '$AccountTitle', '$AccountFirstName', '$InvoiceAccNum', '$InvoiceNumber', '$HandlingCode','$SubsidiaryCode'、'$LastBillBal'、'$CurrentCharges'、'$TotalDueAmt'、'$Rental_othrC'、'$VatTag'、'$UsageTag'、'$OctTag'、'$BalanceCarryFwd'、'$PaymentReceived'、 '$Adjustments', '$Current', '$Over30days', '$Over60days', '$Over90days', '$Over120Days', '$CreditLimit', '$WithoutTaxTag', '$InvoiceCurrency', '$ExchangeRate', '$AsOnDate')";
mysql_select_db("bsswebtool",$server);
$server = mysql_connect("localhost","root", "");
$insert_query_query =mysql_query($query_insert_outbound) or die(mysql_error());
$insert_rows_affected= mysql_num_rows($insert_query_query);
//echo $query_insert_outbound;?>
这只是我从表查询中获取数据的示例代码。我需要将结果保存到其他表,谢谢。