值未保存在数据库中

ca1c2owp  于 2021-06-17  发布在  Mysql
关注(0)|答案(0)|浏览(197)

一旦我们点击按钮,我试图更新数据库中的值&同时我需要下载pdf。。。。
一旦数据库中的值[tracking\u id]被更新,就只有我可以下载pdf了。。。。
当我点击按钮时,它不会更新数据库中的跟踪id列。。。。而是显示0。。。。
shippinglabel.php在pastebin中的完整代码

<?php 
$db_handle2= new DBController();
$star="select pincode , xpressbee from shippment_details where xpressbee='xpressbee' and pincode='$pinc'";
$resultstar = $db_handle2->runSelectQuery($star);

if($resultstar)
    { 
       if($orderrecords[$k]["tracking_id"]==''){
?>

    <input type="button" name="shipment" id="xpress" value="xpress" 
    onclick="createshipment('<?php echo $orderrecords[$k]["order_id"]; ?>')" />

<?php }}
?>

<?php 
if($orderrecords[$k]["tracking_id"]!='' && $orderrecords[$k]["shipping_name"]=='xpress')
{?>

<a target="_blank"
href="/ecom1/xpress/xpressdownload.php?orderId=<?php echo $orderrecords[$k]["order_id"]; ?>" 
id="pdfdownload" >

<input type="button" name="shipment" value="DOWNLOAD" /></a>
<?php }?>

<Script>

function createshipment(orderid)
    {

      var assignee='<?php echo $_SESSION['login_user']?>';
      alert(orderid);
      $.ajax({
        url: "xpressshipment.php",
        type: "POST",
        data:'orderid='+orderid+'&assignee='+assignee,
        success: function(data){
          if(data==1)
          {
            $("#pdfdownload").show();
            $("#ekartc").hide();           
          }
          if(data==2){alert("order id not proper.");}
          if(data==0){alert("First Enter Tracking Id.");}
          window.location ="/ecom1/xpress/xpressdownload.php?orderId="+orderid;
          //location.reload();
        }
      });
    }

pastebin中的xpressshipping.php完整代码

<?php

$data = 
array (
'OrderNo' => $order_id,
'AirWayBillNO' => $resultc[0]['awb'],
);

$data = json_encode($data);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
$curl_response = curl_exec($curl);
curl_close($curl);
echo $curl_response ."\n";
$res=json_decode($curl_response);

if($res->AddManifestDetails[0]->ReturnMessage=='successful')
{
    $sqli="update  do_order set tracking_id='".$resultc[0]['awb']."',shipping_name='xpress' , current_status='99' where order_id='".$order_id."'";
    $resulti=$db_handle->executeUpdate($sqli);

    $sqlj = "update ecomexpress_awb set orderid = '".$order_id."',status='assigned' WHERE awb ='".$resultc[0]['awb']."'"; 
    $resultj = $db_handle->runSelectQuery($sqlj);          
}

pastebin中的xpressdownload.php完整代码

<?php

if(isset($_GET['orderId']) && $_GET['orderId']!='')
{
  $orderid=$_GET['orderId'];

}
else
{
   echo 2;
}

$sqlorder = "SELECT comments,tracking_id,order_id,order_date,address,product_type,alternateno,sku,customer_email,price,customer_name,phone_number,payment_type,product_name from do_order where order_id='".$orderid."' limit 1";
$resultdoorder = $db_handle->runSelectQuerys($sqlorder);
if($resultdoorder['tracking_id']=='')
{
  echo "0";

}
else
{
    // pdf download code
}

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题