prepare($sql); // --- التعديل الرئيسي هنا في bindValue --- $stmt->bindValue(':rideId', $data['rideId']); $stmt->bindValue(':driver_id', $data['driver_id']); $stmt->bindValue(':passengerId', $data['passengerId']); // Bind the locations as simple strings $stmt->bindValue(':passengerLocation', $data['passengerLocation']); $stmt->bindValue(':passengerDestination', $data['passengerDestination']); // باقي الـ bindValue تبقى كما هي $stmt->bindValue(':Duration', intval($data['Duration']), PDO::PARAM_INT); $stmt->bindValue(':DurationToPassenger', intval($data['DurationToPassenger']), PDO::PARAM_INT); $stmt->bindValue(':durationOfRideValue', intval($data['durationOfRideValue']), PDO::PARAM_INT); $stmt->bindValue(':Distance', (float)$data['Distance']); $stmt->bindValue(':totalCost', (float)$data['totalCost']); $stmt->bindValue(':paymentAmount', (float)$data['paymentAmount']); $stmt->bindValue(':paymentMethod', $data['paymentMethod']); $stmt->bindValue(':WalletChecked', $data['WalletChecked'] === 'true' ? 1 : 0, PDO::PARAM_INT); $stmt->bindValue(':isHaveSteps', !empty($data['isHaveSteps']) ? 1 : 0, PDO::PARAM_INT); $stmt->bindValue(':step0', $data['step0']); $stmt->bindValue(':step1', $data['step1']); $stmt->bindValue(':step2', $data['step2']); $stmt->bindValue(':step3', $data['step3']); $stmt->bindValue(':step4', $data['step4']); $stmt->bindValue(':passengerWalletBurc', (float)$data['passengerWalletBurc']); $stmt->bindValue(':tokenPassenger', $data['tokenPassenger']); $stmt->bindValue(':name', $data['name']); $stmt->bindValue(':phone', $data['phone']); $stmt->bindValue(':email', $data['email']); $stmt->bindValue(':startNameLocation', $data['startNameLocation']); $stmt->bindValue(':endNameLocation', $data['endNameLocation']); $stmt->bindValue(':carType', $data['carType']); $stmt->bindValue(':kazan', (float)$data['kazan']); $stmt->bindValue(':direction', $data['direction']); $stmt->bindValue(':timeOfOrder', $data['timeOfOrder']); $stmt->bindValue(':totalPassenger', intval($data['totalPassenger']), PDO::PARAM_INT); log_message("SQL statement prepared successfully. Attempting to execute..."); if ($stmt->execute()) { log_message("SUCCESS: Database insert was successful for rideId: " . $data['rideId']); jsonSuccess(null, "نجحت الإضافة"); } else { $errorInfo = $stmt->errorInfo(); $error_msg = "FAILURE: Database insert failed. PDO Error: " . implode(" | ", $errorInfo); log_message($error_msg); jsonError("failure"); } } catch (Exception $e) { $error_msg = "EXCEPTION: An unexpected error occurred: " . $e->getMessage(); log_message($error_msg); jsonError("failure"); } ?>