Re: No output

From: Date: Wed, 28 Mar 2001 03:33:07 +0000
Subject: Re: No output
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-45815@lists.php.net to get a copy of this message
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: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#45815) next »