在php Page中,一旦单击“ 提交”按钮,就会在数据库中保存订单ID,它的工作正常。...
要求:
如果付款方式为“货到付款”,那么我要在“ awb_type:COD” 行中保存订单ID。...否则在“ awb_type:PPD” 中保存>行。
这是完整的代码,track.php:https://pastebin.com/zLjpee7A,call.php:https://pastebin.com/4LkcxTYE
但是订单在表中更新了两次-PPD中的一行,COD中的一行
如果您需要更多信息,请告诉我。...
更新2:
现在我尝试使用下面的代码,但是什么是payment_type,其仅保存在awb_type列中:PPD行 ....
$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);
}
答案 0 :(得分:2)
在我未将Payment_type与order_id绑定之前,以下代码对我有用:
if(isset($_POST['order_id']) && $_POST['order_id']!='')
{
$order_id = $_POST['order_id'];
$payment_type=$_POST['payment_type'];
$sqlg="SELECT * FROM do_order where payment_type='".$payment_type."'";
$resultg = $db_handle->runSelectQuery($sqlg);
if($payment_type=="Cash on delivery")
{
$sqlc = "select * from ecomexpress_awb WHERE status='unused' AND awb_type='COD' limit 1";
}
else
{
$sqlc = "select * from ecomexpress_awb WHERE status='unused' AND awb_type='PPD' limit 1";
}
$resultc = $db_handle->runSelectQuery($sqlc);