我有带酒店、订单类型和描述的数据库 A。我想从数组 $new_array 向数据库 A 插入值。
//数组 $new_array
Array
(
[0] => Array
(
[order_type] => 1
[currency] => 26
[net] =>
[rate] =>
[amount] =>
[bank_surcharge] =>
[ticket] =>
[profit] =>
[selling_price] =>
[description] => a
[hotel] => 1
[vendor] => 11
)
[1] => Array
(
[order_type] => 2
[currency] => 27
[net] =>
[rate] =>
[amount] =>
[bank_surcharge] =>
[ticket] =>
[profit] =>
[selling_price] =>
[description] => b
[hotel] => 1
[vendor] => 11
)
...
...
}
我试过这个脚本,但什么也没发生:(
for($i = 0; $i < sizeof($new_array['order_type']); $i++){
mssql_query("INSERT INTO A(hotel_id, order_type, description)
VALUES('$new_array[$i]', '$new_array[$i]', '$new_array[$i]')");
}
如何用 php 做到这一点?请任何人帮助我。