encryptData(trim($phone)); // ثم بدّل الحقل في WHERE إلى phone = :ph $sql = "SELECT `id`, `error`, `userId`, `userType`, `phone`, `created_at`, `device`, `details`, `status` FROM `error` WHERE `phone` = :ph OR `phone` LIKE :phLike ORDER BY `created_at` DESC LIMIT 20"; $stmt = $con->prepare($sql); $stmt->execute([ ":ph" => trim($phone), ":phLike" => '%' . trim($phone) . '%', // يسمح بجزء من الرقم إن أردت ]); $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); jsonSuccess($rows); } catch (Exception $e) { error_log("error_search_by_phone.php: " . $e->getMessage()); jsonError($message = "Failed to search errors by phone"); }