Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "myDB";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$payment_id = $response['payments'][0]['payment_id'];
$buyer_name = $response['payments'][0]['buyer_name'];
$buyer_email = $response['payments'][0]['buyer_email'];
$purpose = $response['purpose'];
$payment_status = $response['status'];
$payment_amount = $response['amount'];
$query = mysqli_query($conn,"INSERT INTO TABLE_NAME (payment_id,buyer_name,buyer_email,purpose,payment_status,payment_amount)
VALUES('$payment_id','$buyer_name','$buyer_email','$purpose','$payment_status','$payment_amount')");
if ($query) {
echo "Data Inserted";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
mysqli_close($conn);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.