<?php
session_start();
require_once('../connect.php');
require_once('sql_required.php');

// delete_payment.php
if (isset($_POST['unique_id']) && isset($_POST['ref_code'])) {
    $unique_id = $_POST['unique_id'];
    $ref_code = $_POST['ref_code'];

    // Deleting the record from the database
    $query = "DELETE FROM tbl_payments WHERE unique_id = '$unique_id' AND referrence_code = '$ref_code'";

    if (mysqli_query($conn, $query)) {
        echo 'success';
    } else {
        // Log the error for debugging
        error_log("Error deleting record: " . mysqli_error($conn));
        echo 'error';
    }

    // Close connection
    mysqli_close($conn);
}
?>
