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]