add flush(0) on line 165 of results.php