Dies kann an fehlenden Klammern liegen. Schließen Sie Ihren between
ein Bedingungen in Klammern
$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`)";