showProgressMessage functionality

I have a function called showProgressMessage, looks like this:


function showProgressMsg($msg)
{
  echo $msg."<br>";
  ob_flush();
  flush();
  usleep(25000);
}

Now, I initialize my scripts like this:


ini_set('output_buffering', 'Off');// delete the 4096k value
ob_start ();

Now, when I call showProgressMessage, i.e.

showProgressMsg("Getting dgdPart.");

it is supposed to immediately be shown in the browser window.

But it is not. It waits until the script is finished before showing
anything on the screen.

I have more than one script using this and one of them works but
the others don’t. I have done exactly the same thing in all the
scripts. What could be the cause of the problem?

Nice!

ob_flush() doesn’t always work as you’d expect. I’ve tried using it in the same manner as you, but couldn’t ever get it working though :wink:

Cool, I have it working now using the implicit flush.

Thanks…

You’re turning output_buffering off, and then turning it on again with ob_start().

Remove the ob_start() and ob_flush(), maybe it will work after that.