Closed Thread Icon

Topic awaiting preservation: PHP - output while processing? (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=26381" title="Pages that link to Topic awaiting preservation: PHP - output while processing? (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: PHP - output while processing? <span class="small">(Page 1 of 1)</span>\

 
H][RO
Bipolar (III) Inmate

From: Australia
Insane since: Oct 2002

posted posted 08-04-2005 03:13

Hi All, another querky question...

Is it possible to have php code output to the browser WHILE it is processing, rather than waiting till the entire script has processed then start outputting?

The reason for this is I have some database queries that take a little while, and it would be nice to display the results in the "chunks" they are proccessed.

any ideas?

Thanks

H][RO
Bipolar (III) Inmate

From: Australia
Insane since: Oct 2002

posted posted 08-04-2005 03:53

Having tested it a bit it almost seems to do what i want - but not quite... it does start displaying data but kind of lags behind. Like it has showed part of the first group but doesnt show the rest of the first group until the second group has finished processing...

I wonder if there is a way to control it?

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 08-04-2005 08:38

you can call php->flush() which will send all accumulated data to the browser.
But it's up to the browser wether that actually get's shown on screen.

H][RO
Bipolar (III) Inmate

From: Australia
Insane since: Oct 2002

posted posted 08-04-2005 09:44

Your a world of knowledge TP, ill check it out thanks.

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 08-04-2005 14:19

oh, and the back of my brain just mentioned that there seemed to be some combination of php and apache on windows years back that flushed() only the first time, and never again in that script...

Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 08-06-2005 04:42

I seem to recall flush() doesn't always work unless the buffer is full? I could be wrong.

« BackwardsOnwards »

Show Forum Drop Down Menu