how to buffer output

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

    how to buffer output

    hi

    vishal here. can anyone tell me that how to buffer output and then send
    the output to client at a time.

    what is my problem is that i have a php file which runs query on
    database and takes some time to get query result. so what i want is i
    want to buffer output till the query returns result and then send the
    buffered output to client at a time.

    thxs for help in advance.

  • Tim Van Wassenhove

    #2
    Re: how to buffer output

    On 2005-03-03, vishal <vishal_panjabi @yahoo.co.in> wrote:[color=blue]
    > hi
    >
    > vishal here. can anyone tell me that how to buffer output and then send
    > the output to client at a time.
    >
    > what is my problem is that i have a php file which runs query on
    > database and takes some time to get query result. so what i want is i
    > want to buffer output till the query returns result and then send the
    > buffered output to client at a time.
    >[/color]

    read the fine manual.... http://www.php.net/ob_start and others.....

    --
    Met vriendelijke groeten,
    Tim Van Wassenhove <http://www.timvw.info>

    Comment

    • deresh

      #3
      Re: how to buffer output

      On Thu, 03 Mar 2005 05:17:49 -0800, vishal wrote:
      [color=blue]
      > hi
      >
      > vishal here. can anyone tell me that how to buffer output and then send
      > the output to client at a time.
      >
      > what is my problem is that i have a php file which runs query on database
      > and takes some time to get query result. so what i want is i want to
      > buffer output till the query returns result and then send the buffered
      > output to client at a time.
      >
      > thxs for help in advance.[/color]

      use output buffering:

      on the first lin of your script ( the one that does db query) put :
      ob_start();

      // do your db query
      // and setup resulting html
      // the normal way (usning echo, print etc..)
      // then just call:

      ob_end_flush(); // this outputs output buffer and turns off output
      buffering




      Comment

      Working...