Web Analytics Made Easy -
StatCounter Flush! clearing buffer - CodingForum

Announcement

Collapse
No announcement yet.

Flush! clearing buffer

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Flush! clearing buffer

    I would like to FLUSH() the completed variable (which are in a loop) to the users screen. This is working. However how do I clear the buffer, before outputing the next variable to the screen.???? I hope this is making sense.
    Eg. Currently each buffer stays on screen, is their a way to clear them, before the next buffer???

    function SendMail {
    ob_start();

    while ($i < $num) {
    bla bla bla ;
    mail($to, $subject, $bodymsg, $headers);

    echo 'row';
    $i++;

    ob_flush();
    flush();
    sleep(1);

    }

    echo "Done.";
    ob_end_flush();

  • #2
    You have to understand the buffer is "stuff that hasn't been sent to the client browser". Once you flush the buffer and stuff is sent, there's no way to get it back-- it's gone from the buffer, so clearing the buffer would do no good.

    There may be a tricky way to do it via Javascript and the docuent.innerHTML element-- that is, write the page first, include a tag named 'updateMsg', and then write the output being flushed something like document.getElementById('updateMsg').innerHTML = 'row';

    Comment


    • #3
      Yes I have seen that done else where. So I might try it.

      The only reason why I was asking about clearing, is you can imagine if i had.
      echo "<div>$percentage loaded</div>";

      It wouldnt work at all. I was recommended to use .css where I use the Z-index attribute to place these divs on top of each other. But I dont think it would work in my purpose where I have more then 1000 results. If anyting i dont u can more then 1000 Z-index

      Comment

      Working...
      X