[Q] How can I keep echo "step 1 done..."; smoothly while it done .

Discussion in 'PHP' started by Eng_A_Moktar, Oct 28, 2009.

  1. #1
    I hope i can deliver my question to you,
    I have a small script, it do something like sending emails for a list;

    so it is a batch, i wanna echo
    step 1 done ... - when step 1 is done
    step 2 done ... - when step 2 is done

    etc..

    not echo
    step 1 done
    step 2 done
    etc..
    when all done .
    I wanna make it like that we see when installing vista for example.
    can anyone help, please ?

    thanks...
     
    Eng_A_Moktar, Oct 28, 2009 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    
    while (/* what what */)
    {
        echo 'what';
        @ob_flush();
        @flush();
    }
    
    PHP:
     
    nico_swd, Oct 28, 2009 IP
  3. Eng_A_Moktar

    Eng_A_Moktar Greenhorn

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #3
    Thanks, so much
     
    Eng_A_Moktar, Oct 28, 2009 IP
  4. tonythetiger

    tonythetiger Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    It alsways better practice to use ob_start() when output buffering before you flush. Another creative solution is the use of ajax and php to do the stepping business logic.
     
    tonythetiger, Oct 28, 2009 IP