RE: [PHP-DEV] flush vs. sleep
| From: | Nick Newbold | Date: | Fri, 07 Apr 2000 08:21:48 +0000 |
| Subject: | RE: [PHP-DEV] flush vs. sleep | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-17695@lists.php.net to get a copy of this message | ||
Splitting the sleep up from the first bit of code works fine.
Eg.
<HTML>
<h1> test </h1>
<BR><HR><BR>
<?
Function wait()
{
echo "waiting.....";
flush();
}
wait();
?>
<?
sleep (10);
echo "ok done";
?>
</HTML>
Hope this helps,
Nick
-----Original Message-----
From: Michael Krax (DE) [mailto:michael.krax@gamesonline.de]
Sent: 06 April 2000 19:51
To: 'php-dev@lists.php.net'
Subject: [PHP-DEV] flush vs. sleep
Hello,
the problem is that flush sometimes does not work if it is followd by a
sleep e.g [example 1]:
print"Hello World";
flush();
sleep(5);
displays nothing until the 5 seconds are over!
The main target is to do a loop to get data out of a database to run a chat.
Here is the main function [example 2]:
$result_show=mysql_query("select author, message from chat where message_id
> '$last_msg'");
$row_show=mysql_num_rows($result_show);
function chat_loop($last_msg)
while ($row_show = mysql_fetch_row($result_show))
print"$row_show[1]: $row_show[2]<br>";
flush();
$last_msg = $row_show[0];
};
sleep(2);
chat_loop($last_msg);
};
The strange thing is that it sometimes example 1 works. But only if NOT
running in a frame. Using IE5, Apache, PHP3
Any suggestions,
mikx
P.S. i can not drop the sleep --> stack overflow :-\
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net
For additional commands, e-mail: php-dev-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net
This email has been virus scanned using Sophos Anti-Virus by intY
(www.inty.net)
This email has been virus scanned using Sophos Anti-Virus by intY (www.inty.net)