Initial commit with updated Auth and media ignored
This commit is contained in:
35
ride/tips/get.php
Normal file
35
ride/tips/get.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../../connect.php';
|
||||
|
||||
// فلترة البيانات
|
||||
$driverID = filterRequest("driverID");
|
||||
$passengerID = filterRequest("passendgerID"); // إذا كان الاسم كذلك في قاعدة البيانات
|
||||
|
||||
// إعداد SQL آمن باستخدام bindParam
|
||||
$sql = "
|
||||
SELECT
|
||||
`id`,
|
||||
`driverID`,
|
||||
`passendgerID`,
|
||||
`rideID`,
|
||||
`tipAmount`
|
||||
FROM
|
||||
`tips`
|
||||
WHERE
|
||||
(`driverID` = :driverID OR `passendgerID` = :passengerID)
|
||||
";
|
||||
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindParam(':driverID', $driverID);
|
||||
$stmt->bindParam(':passengerID', $passengerID);
|
||||
|
||||
$stmt->execute();
|
||||
$data = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
// فحص النتائج
|
||||
if ($data) {
|
||||
jsonSuccess($data);
|
||||
} else {
|
||||
jsonError("No tips records found");
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user