Results 1 to 6 of 6

Thread: ob_start [resolved]

  1. #1

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945

    ob_start [resolved]

    Does ob_start not work for something where you echo statements? I have some code where I put ob_start at the top, it fills a select box, and then I want to insert it later, not immediately, so can't I do a flush of the buffer to spit it out later?

    I hope that makes sense.
    Last edited by ober0330; Jul 23rd, 2004 at 10:13 AM.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    No, that's not quite how it works.... at least that's not how I understand it works. when you use ob_start, I think it jsut simply ques things up, just doesn't send it to the client right away. when you then flush it, it still sends everything in the same order it was queued up in.... I think... don't hold me to it, I could be wrong.

    TG
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    Well... that's not exactly what I'm asking. It doesn't seem to be holding the output in the buffer. Every echo statement after ob_start goes straight to the output. It doesn't wait for me to say ob_end_flush.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  4. #4

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    Ok, I think I misunderstood the purpose of this function, so I've made my own function to suit my needs and I just call that function when I need the output now.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  5. #5
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906
    Try this PHP script:
    PHP Code:
    <?php
    ob_start 
    ();

    /* echo statements go here */
    echo ("1) this will be printed\n");

    ob_start ();

    /* more echo statements go here */
    echo ("2) this won't be printed\n");

    ob_end_clean (); /* discards contents */

    ob_start ();

    echo (
    "3) this will be printed\n");

    ob_end_flush (); /* will flush this buffer into the top buffer */

    /* echo statments */
    echo ("4) this will be printed\n");

    /* send a header */
    header ('Content-Type: text/plain');

    ob_end_flush ();
    ?>
    That is a short demonstartion of how the output buffering works. You should get the following output:
    Code:
    1) this will be printed
    3) this will be printed
    4) this will be printed
    If you don't get that then there is a problem with output buffering. You should check the directive implicit_flush is set 0 in your php.ini.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  6. #6

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    Well... my problem was that I wasn't putting that at the top of the page, because I need to analyze some input before I get to that point... and I guess I don't really want to do all that before sending the headers.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width