<?php
require_once __DIR__ . '/../../connect.php';

// استقبال المتغيرات
$driverID    = filterRequest("driverID");
$passengerID = filterRequest("passengerID");
$rideID      = filterRequest("rideID");
$note        = filterRequest("note");

// تنفيذ الإدخال بطريقة آمنة
$sql = "INSERT INTO `canecl` (`driverID`, `passengerID`, `rideID`, `note`) 
        VALUES (:driverID, :passengerID, :rideID, :note)";
$stmt = $con->prepare($sql);
$stmt->bindParam(':driverID', $driverID);
$stmt->bindParam(':passengerID', $passengerID);
$stmt->bindParam(':rideID', $rideID);
$stmt->bindParam(':note', $note);
$stmt->execute();

if ($stmt->rowCount() > 0) {
    jsonSuccess(null, "Record inserted successfully");
} else {
    jsonError("Failed to insert record");
}
?>