Update: 2026-06-29 23:09:43
This commit is contained in:
34
loction_server/siro/ride/location/addpassengerLocation.php
Executable file
34
loction_server/siro/ride/location/addpassengerLocation.php
Executable file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
include "../../connect.php";
|
||||
|
||||
$passengerId = filterRequest("passengerId");
|
||||
$lat = filterRequest("lat");
|
||||
$lng = filterRequest("lng");
|
||||
$rideId = filterRequest("rideId");
|
||||
|
||||
// Validate the latitude and longitude
|
||||
if ($lat === '' || $lng === '') {
|
||||
printFailure("Latitude and longitude cannot be empty");
|
||||
exit;
|
||||
}
|
||||
|
||||
// Prepare an SQL statement with placeholders
|
||||
$sql = "INSERT INTO `passengerlocation`( `passengerId`, `lat`, `lng`, `rideId`) VALUES (:passengerId, :lat, :lng, :rideId)";
|
||||
|
||||
$stmt = $con->prepare($sql);
|
||||
|
||||
// Bind the parameters to the SQL query
|
||||
$stmt->bindParam(':passengerId', $passengerId);
|
||||
$stmt->bindParam(':lat', $lat);
|
||||
$stmt->bindParam(':lng', $lng);
|
||||
$stmt->bindParam(':rideId', $rideId);
|
||||
|
||||
// Execute the statement
|
||||
if ($stmt->execute()) {
|
||||
// Print a success message
|
||||
printSuccess("Passenger location saved successfully");
|
||||
} else {
|
||||
// Print a failure message
|
||||
printFailure("Failed to save passenger location");
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user