I have a simple php page, that is doing some operations for an mysql result set:
$i = $d = $n = 0;
$sql="SELECT record, field1,field2,field3 from table where condition='xxxx'" ;
result=$db->send_sql($sql);
while($row=mysql_fetch_array($result, MYSQL_ASSOC))
{
//about 500 results
//now performing some actions on these results via function call
$i++;
if($row['field1'] == 'xxx')
{
$d++;
echo $row['record'].": ";
echo do_something(field1,field2); //function will echo some text
echo "<br>";
}
else
{
$n++;
echo $row['record'].": nothing to do <br>";
}
}
echo "<hr>Total: ".$i." - Updates: ".$d." - Nothing done: ".$n;
All works, as it should but the Output/echos are only shown, once all operations have been done and the while statement has been worked through.
It might be a silly question, but is there a way to show the "echos/output" "on the fly" - so the user get's the "something is happening" experience?
\r\n"; flush(); – Christian K. Nov 19 '13 at 14:48