データベースへの書き込みを繰り返した後、同じクエリ ステートメントで結果が生成されません
<br> <?php<br> <br> set_time_limit(0); <br> $filepath=$_GET['uploadfile'];<br> require_once '../conn.php';<br> <br> error_reporting(E_ALL ^ E_NOTICE); <br> $line=0;<br> $shipments=0;<br> $i=0;<br> $s=0;<br> $f=0;<br> <br> $strSqla="SELECT MAX(number) FROM `sale_orders_restock`" // sale_orders_restock テーブルの id フィールドの最大値をクエリします<br> $querya = mysql_query($strSqla,$conn); $resultaa= mysql_fetch_row($querya);<br> $maxnum=$resultaa[0];<br> $maxnum ;<br> <br> <br> $file = fopen($filepath,"r") または die("ファイルを開けませんでした"); <br> while (!feof($file)) { <br> <br> $buffer = fgets($file);<br> <br> if ($line0)<br> { <br> <br> <br> $u=explode(' ', トリム($buffer));<br> if(!empty($u[0])){<br> <br> <br> $sku=$u[10];<br> <br> $sql_itemcode="SELECT * FROM `sku_rule` WHERE `sku` = '$sku'";<br> $querya = mysql_query($sql_itemcode,$conn); $rs= mysql_fetch_array($queya);<br> <br> <br> <br> $jj_sku=$rs['アイテムコード'];<br> $delivery_areas=$rs['delivery_areas'];<br> $zhanghao=$rs['アカウント'];<br> <br> <br> <br> $or_id=$u[0];<br> $or_it_id=$u[1];<br> $payments_date=$u[3];<br> <br> <br> $buyer_email=$u[7];<br> $buyer_name=mb_convert_encoding(addslashes($u[8]), 'UTF-8','utf-8, shft-jis, gbk');<br> $buyer_phone=mb_convert_encoding(addslashes($u[9]), 'UTF-8','utf-8, shft-jis, gbk');<br> <br> <br> $product_name=mb_convert_encoding(addslashes($u[11]), 'UTF-8','utf-8, shft-jis, gbk');<br> $quantity=$u[12];<br> <br> $recipient_name=mb_convert_encoding(addslashes($u[16]), 'UTF-8','utf-8, shft-jis, gbk');<br> $ship_address1=mb_convert_encoding(addslashes($u[17]), 'UTF-8','utf-8, shft-jis, gbk');<br> $ship_address2=mb_convert_encoding(addslashes($u[18]), 'UTF-8','utf-8, shft-jis, gbk');<br> $ship_address3=mb_convert_encoding(addslashes($u[19]), 'UTF-8','utf-8, shft-jis, gbk');<br> <br> <br> $ship_city=mb_convert_encoding(addslashes($u[20]), 'UTF-8','utf-8, shft-jis, gbk');<br> $ship_state=mb_convert_encoding(addslashes($u[21]), 'UTF-8','utf-8, shft-jis, gbk');<br> $ship_postal=mb_convert_encoding(addslashes($u[22]), 'UTF-8','utf-8, shft-jis, gbk');<br> $ship_country=mb_convert_encoding($u[23], 'UTF-8','utf-8, shft-jis, gbk');<br> $cancel_order=0;<br> $logistics_number="";<br> $logistics_company="";<br> <br> <br> $strSql_item="SELECT * FROM `jperp`.`1_item_codes` WHERE `item_code`='$jj_sku'"; $query_item = mysql_query($strSql_item,$conn); $rs=mysql_affected_rows();<br> $kit=0;<br> if($rs>1)<br> {<br> while($rs = mysql_fetch_array($query_item) ){<br> $or_it="";<br> $jj_sku=$rs['stock_id'];<br> <br> $item_quantity=$rs['数量'];<br> $quantity=$quantity*$item_quantity;<br> <br> if($kit>0){<br> $or_it=$or_it_id.$kit;<br> }<br> それ以外<br> {<br> $or_it=$or_it_id;<br> }<br> <br> $sql_sale=" INSERT INTO `amazon_erp`.`sale_orders_restock` (`number` ,`order_id` ,`order_item_id`,`shipments` ,`payments_date` ,`buyer_email` ,`buyer_name`,`buyer_phone_number`,`sku`, `jj_sku`、`product_name`、`quantity_purchased`、`recipient_name`、`ship_address_1`、`ship_address_2`、`ship_address_3`、`ship_state`、`ship_postal_code`、`ship_country`、`account`、`ship_city`、`cancel_order `,`配達地域`,`物流番号`,`物流会社`)VALUES ('$maxnum','$or_id','$or_it', '$shipments', '$payments_date','$buyer_email', '$buyer_name' ,'$buyer_phone','$sku' ,'$jj_sku', '$product_name', '$quantity', '$recipient_name', '$ship_address1', '$ship_address2','$ship_address3','$ship_state' 、'$ship_postal', '$ship_country', '$zhanghao', '$ship_city','$cancel_order','$delivery_areas','$logistics_number','$logistics_company')"; <br><br>