Instant Result From Php Script

Discussion in 'PHP' started by SNaRe, Nov 24, 2007.

  1. #1
    I wrote a script. It's working at least 10 minutes and after all this time it shows the results at the end.Script stops and it shows the result. Is there a way to show results instantly. The datas that will shown on the page comes in random time.
     
    SNaRe, Nov 24, 2007 IP
  2. Brewster

    Brewster Active Member

    Messages:
    489
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    60
    #2
    Brewster, Nov 24, 2007 IP
    commandos likes this.
  3. tonybogs

    tonybogs Peon

    Messages:
    462
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You can accomplish this by using PHPs output buffering.

    Do something like this

    
    // at the top of your script
    ob_start();
    
    // Insert all of your code here
    
    // At the end of your script
    $output = ob_get_contents();
    ob_end_clean();
    
    // Here you can do any work on your $output, like replacements etc.
    
    echo $output;
    
    PHP:
    This stores everything into the output buffer so when you echo, it spits everything your script generated out in 1 hit.

    Hope this helps :)
     
    tonybogs, Nov 24, 2007 IP