oppure potete utilizzare
www.php.net/ob_start

codice:
<?php
ob_start("ob_gzhandler");
for() 
query_update 
echo query 
_chiusura for 

header