you can't stream output like that.......netscape will wait until your
HTML output is done, but if you're infinitely looping, it won't be, and
you'll never get your </body></html> tags.....i've seen a number of
posts trying to do chats and flush() the output, but bottom line, if you
don't send it a complete html file, it won't be happy.....one
suggestion: you could try sending a complete file, then refreshing it
every few seconds.....but, there would be better ways to do this (like
java)
-jack
"Sean B." wrote:
>
> I'm attempting to write a chat which streams HTML. There's a problem with the
> main function that's responsible for 'streaming'. It loops endlessly and if
> anytihng new appears in the database, it parses it into HTML and outputs it
> via the echo command. The chatboxDisplay method is what is responsible for
> parsing and echoing the message and the HTML for it. This is the problem
> code. The code is syntactically correct; it runs, in fact, if you remove the
> while stuff, it DOES work, except for the fact that it doesn't 'stream' like
> it should (Because it's not looping. It fires the output and the script
> ends). So when I put the while brackets back on to make it 'stream', there's
> no output. (as in, in netscape 4.7x it doesn't send much anything. the screen
> remains grey and just perpetually loads nothing) Any ideas as to what the
> heck is going on?
>
> Thanks.
>
> -------
>
> while (1) {
>
> $posts=mysql_query("SELECT * FROM chat ORDER BY date DESC;") or die
> ("Query failed line 111");
> $data=mysql_fetch_array($posts);
>
> while ($data=mysql_fetch_array($posts)) {
> chatboxDisplay($data);
> if ($data[id] > $id) { $id = $data[id]; }
> }
>
> flush();
> sleep(2);
>
> }
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]