ho testato il tuo script che penso che è buono però mi dice che non ho dichiarato la variabile query