Jump to content

Recommended Posts

You couldn't really do that with php, as the page would hang until the script had been parsed. All you'd be doing with a 2 second pause would be making the page hang for longer.

 

You might want to use javascript to reveal a hidden div every two seconds or something though.

 

Edit: Well...I suppose you could do it with output buffering, but it wouldn't be as reliable as javascript.

Link to comment
https://forums.phpfreaks.com/topic/155366-solved-db-question/#findComment-817419
Share on other sites

Surely javascript would be more reliable?

Fore example, with output buffering, it would only display the page up to the point that had been parsed when you echo the buffer contents. So if you have a footer or something, it won't be displayed until everything else has been.

Link to comment
https://forums.phpfreaks.com/topic/155366-solved-db-question/#findComment-817436
Share on other sites

Personally i am quite ignorant here. I am looking in to both and i'll see what i come up with. This looks pretty much what i am after. havent tested it yet though.

 

<?php

if (ob_get_level() == 0) ob_start();

for ($i = 0; $i<10; $i++){

        echo "<br> Line to show.";
        echo str_pad('',4096)."\n";   

        ob_flush();
        flush();
        sleep(2);
}

echo "Done.";

ob_end_flush();

?>

Link to comment
https://forums.phpfreaks.com/topic/155366-solved-db-question/#findComment-817448
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.