IPN未发布到数据库(IPN模拟器)

时间:2015-10-13 20:29:40

标签: php mysqli paypal paypal-ipn

以下是相关代码(来自IPN页面的代码段):

 if($payment_status=='Completed'){

    $txn_id_check = mysqli_query($mysqli,"SELECT 'transaction_id' FROM 'payment' WHERE 'transaction_id'='".$txn_id."'");
    if(mysqli_num_rows($txn_id_check)!=1){

        if($receiver_email=='fortunefilly@hotmail.com'){

            if($payment_amount=='9.99' && $payment_currency=='GBP'){

                // add txn_id to db
                $query = "INSERT INTO payment (transaction_id, payment_status, users_id) VALUES(?, ?, ?)";
                $statement = $mysqli->prepare($query);
                $statement->bind_param('sss',$txn_id, $payment_status,$id);
                if($statement->execute()){
                print 'Success! ID of last inserted record is : ' .$statement->insert_id .'<br />'; 
                }else{
                die('Error : ('. $mysqli->errno .') '. $mysqli->error);
                }
                $statement->close();
                // update premium to 1 

                $update_premium = mysqli_query("UPDATE 'users' SET is_member ='1' WHERE 'id' ='".$id."'");
            }
        }
    }
}

正如您所看到的,我正在关注paypals示例代码给我的评论。

插入数据库时​​出现问题但不确定问题。

0 个答案:

没有答案