I just put it into my script, and it doesn't seem to be working. I put
ob_end_clean(); at the top of the script, but here's the while loop I have:

        while($db->next_record()):
        echo '<b>'.$db->Record["user"].':</b>&nbsp;&nbsp;';
        $sql = "SELECT emote, image FROM c_emotes";
        $result = mysql_query($sql, $db->linkid);
        while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { 
        $emotes[] = $row['emote']; 
        $images[] = "<img src='".$row['image']."'>"; 
        }
        if($db->Record['system'] != 1) {
                $message = htmlentities($db->Record["text"]);
        } else {
                $message = $db->Record["text"];
        }
        $message = str_replace($emotes, $images, $message);
        echo $message."<br>\n";
        flush();
        endwhile; 

It displays just fine if you refresh, but unless you refresh, you don't see
any new data. Any ideas?
 
Thanks,
Stephen Craton
http://www.melchior.us

-----Original Message-----
From: Justin Patrin [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 24, 2004 4:47 PM
To: Stephen Craton
Cc: PHP List
Subject: Re: [PHP] Streaming

ob_end_clean() goes at the top.
flush() goes after *every* pice of info you want to show real-time.
Basically, after every echo or group of echos.

On Thu, 24 Jun 2004 16:43:39 -0500, Stephen Craton <[EMAIL PROTECTED]>
wrote:
> 
> Thanks for this, but how do I use it? Do I just put the ob_end_clean() 
> at the opening the page I want to stream and then put flush() at the end?
> 
> Thanks,
> Stephen Craton
> http://www.melchior.us
> 
> 
> 
> -----Original Message-----
> From: svk [mailto:[EMAIL PROTECTED]
> Sent: Thursday, June 24, 2004 4:25 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Streaming
> 
> On Thu, 2004-06-24 at 16:41, Stephenpp
> 
> To use "streaming", you have to :
> Turn off output buffering: ob_end_clean() and flush the output has it 
> comes
> : flush()
> 
> It is useful to note that :
> "Some versions of Microsoft Internet Explorer will only start to 
> display the page after they have received 256 bytes of output, so you 
> may need to send extra whitespace before flushing to get those browsers to
display the page.
> "
> 
> and
> "Pad your output with necessary spaces, wrap your progressing data 
> around open (<table>) and end (</table>) tags, and then call flush() 
> so that one script will work for Netscape as well.
> "
> 
> > I was browsing the net and I found a PHP chat script that claimed 
> > that it does not refresh, rather it has "streaming text". This got 
> > my interest and was wondering how the script did it. I downloaded 
> > it's source code but couldn't find anything useful in it, very hard 
> > to read in my opinion. I did a search on PHP.net for streaming but I 
> > couldn't understand much of that, just my noobishness I suppose.
> >
> > How exactly would you go about streaming in PHP anyway? This has my 
> > interest now...
> >
> > Thanks,
> > Stephen Craton
> > http://www.melchior.us <http://www.melchior.us/>
> >
> 
> --
> PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: 
> http://www.php.net/unsub.php
> 
> --
> PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: 
> http://www.php.net/unsub.php
> 
> 
> !DSPAM:40db491f54512097234068!
> 
> 


--
paperCrane --Justin Patrin--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to