Once i click on submit button in php page , I am calling url & passing values dynamically fetching from do_order table....
For each awb , i am assiging the order in ecomexpress_awb table :
So Along with do_order table values, i need to pass awb column values present in
ecomexpress_awbtable, so i tried below code.
Issue :
Everytime its passing first awb number : 14104918100000 only.... but i need to pass awb assocaited with order....
Please let me know if you need any other information....
<?php
$sqlb="SELECT * FROM ecomexpress_awb";
$resultb = $db_handle->runSelectQuery($sqlb);
$order_id='';
if(isset($_POST['order_id']) && $_POST['order_id']!=''){
$order_id = $_POST['order_id'];
$sqlc = "select * from ecomexpress_awb WHERE status='unused' AND awb_type='COD' limit 1";
$resultc = $db_handle->runSelectQuery($sqlc);
$sqld = "select * from ecomexpress_awb WHERE status='unused' AND awb_type='PPD' limit 1";
$resultd = $db_handle->runSelectQuery($sqld);
$payment_type='';
$sqlg="SELECT * FROM do_order where payment_type='".$payment_type."'";
$resultg = $db_handle->runSelectQuery($sqlg);
if($payment_type=="Cash on delivery")
{
$awb = $resultc[0]['awb'];
$sqle = "update ecomexpress_awb set orderid = '".$order_id."',status='used' WHERE awb ='".$awb."' limit 1";
$resulte = $db_handle->runSelectQuery($sqle);
}
else
{
$awba = $resultd[0]['awb'];
$sqlf = "update ecomexpress_awb set orderid = '".$order_id."',status='used' WHERE awb ='".$awba."' limit 1";
$resultf = $db_handle->runSelectQuery($sqlf);
}
$sqlh="SELECT * FROM do_order where order_id='".$order_id."'";
$resulth = $db_handle->runSelectQuery($sqlh);
$data =
array ('CustomerName' => $resulth[0]['customer_name'],
'OrderNo' => $order_id,
'AirWayBillNO' => $resultb[0]['awb'],
);
$url = "http://114.143.206.69:803/";
$data = json_encode($data);
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
$curl_response = curl_exec($curl);
curl_close($curl);
echo $curl_response ."
";
print_r($data);
full code : https://pastebin.com/8UkX7Vjb