Ecco appunto!!

Invece non mi considera la where ... ma mi conta tutti gli elementi della tabella

$query_count_I ="SELECT *, count(*) as records_I, ... as distance FROM events HAVING timestamp > '$LastUpdate' AND distance <= '$MaxDistance' and status = 'I'";
$result_count_I = mysql_query($query_count_I, $link);
$records_count_I = mysql_fetch_array($result_count_I);
$Records_I = $records_count_I['records_I'];
...

Grazie per l'aiuto