2016-02-27 133 views
0

在获取paypal的金额,货币和交易ID在PHP中的新代码是什么?我有这个代码。从我的教程中,我一直在观察整个制作电子商务网站的过程。Paypal支付代码

//payment details from paypal 

     $amount = $_GET['amt']; 

     $currency = $_GET['cc']; 

     $trx_id = $_GET['tx']; //transaction 

在这里,我要插在它上面这些可变因素(与查询)的数据。

//inserting payment to table 
       $insert_payment= "insert into payments(amount,customer_id,product_id,trx_id,currency) values ('$amount','$c_id','$pro_id','$trx_id','$currency')"; 

       $run_payment = mysqli_query($con, $insert_payment); 

而结果product_id只有数据。我该如何解决它?

回答

0

如果你在mysql查询中有一个php变量,那么你必须添加“。”查询前后的变量。

$insert_payment= "INSERT INTO payments (amount,customer_id,product_id,trx_id,currency) 
VALUES ('.$amount.','.$c_id.','.$pro_id.','.$trx_id.','.$currency.')"; 

现在就来试试..

+0

它不工作。 @Vento从贝宝获取数据是否正确? – Drx

+0

如果它不工作,那么你的变量必须是空的。 给HTML代码.. – Vento