Nick Weisser
Jun 15 2005, 02:50 PM
Hi there,
I've written a script that reads data from different csv files and then
inserts it into a MySQL db in several steps.
I'd like to print out a statement after every successful import step,
but the problem is that the statements are only echoed after the whole
script has been executed.
Could anyone please give me a pointer as to what I'm doing wrong? Or do
I have to give more detailed information on the script I've written?
Thanks,
Nick
Exyle
Jun 15 2005, 03:20 PM
If you can post your script I can probably help, without seeing it I
can't really say anything though.
Nick Weisser wrote:
QUOTE |
Hi there,
I've written a script that reads data from different csv files and then inserts it into a MySQL db in several steps.
I'd like to print out a statement after every successful import step, but the problem is that the statements are only echoed after the whole script has been executed.
Could anyone please give me a pointer as to what I'm doing wrong? Or do I have to give more detailed information on the script I've written?
Thanks, Nick |
Kimmo Laine
Jun 15 2005, 05:11 PM
"Nick Weisser" <[Email Removed]> kirjoitti
viestiss:42b04e49$[Email Removed]...
QUOTE |
Hi there,
I've written a script that reads data from different csv files and then inserts it into a MySQL db in several steps.
I'd like to print out a statement after every successful import step, but the problem is that the statements are only echoed after the whole script has been executed.
Could anyone please give me a pointer as to what I'm doing wrong? Or do I have to give more detailed information on the script I've written?
|
I'd say the server uses output buffering. That speeds up the script
execution, but prevents partial output, like you described. The server sends
the page only when the script has completely executed. There is a function
called flush() that you can use to force server to output the buffer, but
from what I know, it doesn't work with IIS6 for example. Don't know about
apache...
here's what the manual says about it:
void flush ( void )
Flushes the output buffers of PHP and whatever backend PHP is using (CGI, a
web server, etc). This effectively tries to push all the output so far to
the user's browser.
flush() has no effect on the buffering scheme of your webserver or the
browser on the client side.
Several servers, especially on Win32, will still buffer the output from your
script until it terminates before transmitting the results to the browser.
--
"I am pro death penalty. That way people learn
their lesson for the next time." -- Britney Spears
[Email Removed]