Maison  >  Article  >  développement back-end  >  反复写入数据库之后,同样的查询语句却查询不出结果

反复写入数据库之后,同样的查询语句却查询不出结果

WBOY
WBOYoriginal
2016-06-13 12:45:09729parcourir

重复写入数据库之后,同样的查询语句却查询不出结果

<br>
<?php <br />
<br>
set_time_limit(0); <br>
<br>
 $filepath=$_GET['uploadfile'];<br>
require_once '../conn.php';<br>
<br>
error_reporting(E_ALL ^ E_NOTICE); <br>
<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); <br>
$resultaa= mysql_fetch_row($querya);<br>
$maxnum=$resultaa[0];<br>
$maxnum++;<br>
<br>
<br>
$file = fopen($filepath,"r") or die("打开文件失败"); <br>
<br>
while (!feof($file)) { <br>
<br>
$buffer = fgets($file);<br>
<br>
if ($line0)<br>
{	<br>
<br>
<br>
$u=explode('	', trim($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); <br>
$rs= mysql_fetch_array($querya);<br>
<br>
<br>
<br>
$jj_sku=$rs['item_code'];<br>
$delivery_areas=$rs['delivery_areas'];<br>
$zhanghao=$rs['account'];<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'"; <br>
$query_item = mysql_query($strSql_item,$conn); <br>
$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['quantity'];<br>
$quantity=$quantity*$item_quantity;<br>
<br>
if($kit>0){<br>
$or_it=$or_it_id.$kit;<br>
}<br>
else<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`,`delivery_areas`,`logistics_number`,`logistics_company`)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')"; <div class="clear">
                 
              
              
        
            </div>
Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn