Displaying result while still processing.....

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Clouds®

    Displaying result while still processing.....

    Hi all,

    Strange topic, I'll explain it:

    I have a page with a for-loop that takes a long time to execute.
    In this loop, a line of data is printed using printf (or echo).

    I currently see the printed data only after completion of the for-loop.
    What I'd like to have is that each bit of data that is printed in the loop,
    displays at once, so that I can see the progress of the loop...

    Is there a way to achieve this?

    TIA for your help!

    --
    Clouds®




  • Kevin Thorpe

    #2
    Re: Displaying result while still processing.....

    Clouds® wrote:
    [color=blue]
    > Hi all,
    >
    > Strange topic, I'll explain it:
    >
    > I have a page with a for-loop that takes a long time to execute.
    > In this loop, a line of data is printed using printf (or echo).
    >
    > I currently see the printed data only after completion of the for-loop.
    > What I'd like to have is that each bit of data that is printed in the loop,
    > displays at once, so that I can see the progress of the loop...
    >
    > Is there a way to achieve this?[/color]

    while () {
    echo "fkjfijij\n ";
    flush();
    }

    Comment

    • Clouds®

      #3
      Re: Displaying result while still processing.....


      "Kevin Thorpe" <kevin@pricetra k.com> schreef in bericht
      news:4121e08d$0 $12671$afc38c87 @news.easynet.c o.uk...[color=blue]
      > Clouds® wrote:
      >[color=green]
      > > Hi all,
      > >
      > > Strange topic, I'll explain it:
      > >
      > > I have a page with a for-loop that takes a long time to execute.
      > > In this loop, a line of data is printed using printf (or echo).
      > >
      > > I currently see the printed data only after completion of the for-loop.
      > > What I'd like to have is that each bit of data that is printed in the[/color][/color]
      loop,[color=blue][color=green]
      > > displays at once, so that I can see the progress of the loop...
      > >
      > > Is there a way to achieve this?[/color]
      >
      > while () {
      > echo "fkjfijij\n ";
      > flush();
      > }[/color]

      Thnxz...
      For some reason (IE 6.0? XP Pro? webserver?) this still doesn't do the
      trick...
      Any other options?

      --
      Clouds®





      Comment

      • Chris Hope

        #4
        Re: Displaying result while still processing.....

        Clouds® wrote:
        [color=blue]
        >
        > "Kevin Thorpe" <kevin@pricetra k.com> schreef in bericht
        > news:4121e08d$0 $12671$afc38c87 @news.easynet.c o.uk...[color=green]
        >> Clouds® wrote:
        >>[color=darkred]
        >> > Hi all,
        >> >
        >> > Strange topic, I'll explain it:
        >> >
        >> > I have a page with a for-loop that takes a long time to execute.
        >> > In this loop, a line of data is printed using printf (or echo).
        >> >
        >> > I currently see the printed data only after completion of the for-loop.
        >> > What I'd like to have is that each bit of data that is printed in the[/color][/color]
        > loop,[color=green][color=darkred]
        >> > displays at once, so that I can see the progress of the loop...
        >> >
        >> > Is there a way to achieve this?[/color]
        >>
        >> while () {
        >> echo "fkjfijij\n ";
        >> flush();
        >> }[/color]
        >
        > Thnxz...
        > For some reason (IE 6.0? XP Pro? webserver?) this still doesn't do the
        > trick...
        > Any other options?[/color]

        See if this helps:

        ...
        flush();
        ob_flush();

        I sometimes find one on its own doesn't work but when you use both of them
        it usually does. Also make sure any output you have has line breaks before
        doing the flush as this sometimes seems to make a difference.

        --
        Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/

        Comment

        • Alvaro G Vicario

          #5
          Re: Displaying result while still processing.....

          *** Clouds® wrote/escribió (Tue, 17 Aug 2004 14:13:36 +0200):[color=blue]
          > For some reason (IE 6.0? XP Pro? webserver?) this still doesn't do the
          > trick...
          > Any other options?[/color]

          Apart from what you've already been told, check source code in your
          browser. Sometimes they won't display a page until it's fully loaded (esp.
          in there're tables involved).


          --
          -- Álvaro G. Vicario - Burgos, Spain
          -- Questions sent to my mailbox will be billed ;-)
          --

          Comment

          Working...