一旦我们单击Button,我将尝试更新Database&中的值以及需要下载pdf的内容。...
一次值[ tracking_id ]已在数据库中更新,而不是只有我能够下载pdf ....
当我单击按钮时,它不会更新数据库中的 tracking_id 列。...而是显示 0 ....
shippinglabel.php Full code in 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();
}
});
}
xpressshipment.php Full code in pastebin
<?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);
}
xpressdownload.php Full code in pastebin
<?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
}