= NOW() - INTERVAL 180 SECOND AND (cr.make NOT LIKE '%دراجة%' AND cr.model NOT LIKE '%دراجة%') AND d.gender = 'Female' GROUP BY cl.driver_id ORDER BY ratingDriver DESC, ratingCount DESC, cl.updated_at DESC LIMIT 10; "; $stmt = $con->prepare($sql); $stmt->bindParam(':southwestLat', $southwestLat); $stmt->bindParam(':southwestLon', $southwestLon); $stmt->bindParam(':northeastLat', $northeastLat); $stmt->bindParam(':northeastLon', $northeastLon); $stmt->execute(); $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); if ($rows) { $fieldsToDecrypt = [ 'phone','email','gender','birthdate', 'first_name','last_name','token', 'make','car_plate','vin','maritalStatus' ]; foreach ($rows as &$row) { foreach ($fieldsToDecrypt as $field) { if (isset($row[$field]) && $row[$field] !== null && $row[$field] !== '') { try { $row[$field] = $encryptionHelper->decryptData($row[$field]); } catch (Exception $e) { $row[$field] = null; } } } // حساب العمر if (!empty($row['birthdate'])) { try { $birthDate = new DateTime($row['birthdate']); $today = new DateTime(); $row['age'] = $today->diff($birthDate)->y; } catch (Exception $e) { $row['age'] = null; } } else { $row['age'] = null; } } unset($row); printSuccess($rows); } else { printFailure("No car locations found"); } } catch (PDOException $e) { printFailure("Database error: " . $e->getMessage()); } catch (Throwable $e) { printFailure("Internal error: " . $e->getMessage()); }