Cela peut être le manque de parenthèses.Enveloppez votre between
conditions entre parenthèses
$query = "SELECT *
FROM earthquakes
WHERE (milliseconds BETWEEN `$ieri` AND `$oggi`)
AND (magnitude BETWEEN `$magn_min` AND `$magn_max`)
AND (ipocentro BETWEEN `$ipo_min` AND `$ipo_max`)
OFFSET $offset LIMIT 400";
$n_quakes = "SELECT COUNT(*)
FROM earthquakes
WHERE (milliseconds BETWEEN `$ieri` AND `$oggi`)
AND (magnitude BETWEEN `$magn`_min AND `$magn_max`)
AND (ipocentro BETWEEN `$ipo_min` AND `$ipo_max`)
AND (latitude BETWEEN `$lat_inf` AND `$lat_sup`)
AND (longitude BETWEEN `$lng_sin` AND `$lng_des`)";