prova ad aggiungere uno spazio dopo il where
$query = "SELECT id, titolo, data FROM news WHERE " . $query ;