<?php
include "../../connect.php";
//ridedriverPayment/add.php
$amount = filterRequest("amount");
$paymentMethod = filterRequest("payment_method");
$driverID = filterRequest("driverID");

$sql = "INSERT INTO `paymentsDriverPoints` (`amount`, `payment_method`, `driverID`) 
        VALUES ('$amount', '$paymentMethod', '$driverID')";

$stmt = $con->prepare($sql);
$stmt->execute();

if ($stmt->rowCount() > 0) {
    
    $insertedID = $con->lastInsertId(); // Get the last inserted ID
    printSuccess($message =  $insertedID);
} else {
    $response = array(
        "success" => false,
        "message" => "Failed to save payment data"
    );
    echo json_encode($response);
}
?>