<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[PunBB Forums — PHP while loop problem]]></title>
		<link>https://punbb.informer.com/forums/topic/10157/php-while-loop-problem/</link>
		<atom:link href="https://punbb.informer.com/forums/feed/rss/topic/10157/" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in PHP while loop problem.]]></description>
		<lastBuildDate>Mon, 16 Jan 2006 00:46:14 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: PHP while loop problem]]></title>
			<link>https://punbb.informer.com/forums/post/60352/#p60352</link>
			<description><![CDATA[<p>You could set a timeout on the stream, obviously it is not ideal, but as far as im aware there isn&#039;t a way to check if there is data to be read or not.</p><p><a href="http://uk.php.net/manual/en/function.stream-set-timeout.php">http://uk.php.net/manual/en/function.st … imeout.php</a></p>]]></description>
			<author><![CDATA[null@example.com (Reines)]]></author>
			<pubDate>Mon, 16 Jan 2006 00:46:14 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/60352/#p60352</guid>
		</item>
		<item>
			<title><![CDATA[Re: PHP while loop problem]]></title>
			<link>https://punbb.informer.com/forums/post/60350/#p60350</link>
			<description><![CDATA[<p>Okay, according to Mediator, fgets waits until it receives data to continue.<br />I need some way around this... really really bad.<br />Maybe something like if (fgets(...)) ?</p>]]></description>
			<author><![CDATA[null@example.com (Gary13579)]]></author>
			<pubDate>Mon, 16 Jan 2006 00:38:12 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/60350/#p60350</guid>
		</item>
		<item>
			<title><![CDATA[PHP while loop problem]]></title>
			<link>https://punbb.informer.com/forums/post/60348/#p60348</link>
			<description><![CDATA[<p>This is being used for an IRC client..</p><div class="quotebox"><blockquote><p>while (true)<br />&nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $query = mysql_query(&quot;SELECT * FROM rows WHERE session_id=&#039;&quot;.$config[&#039;session_id&#039;].&quot;&#039;&quot;) or die(mysql_error());<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (mysql_num_rows($query)) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while ($row = mysql_fetch_assoc($query)) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cmd_send(prep_text($row[&#039;message&#039;], $row[&#039;channel&#039;]));<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mysql_query(&quot;DELETE FROM rows WHERE session_id=&#039;&quot;.$config[&#039;session_id&#039;].&quot;&#039;&quot;);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo &quot;blah\n&quot;;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $con[&#039;buffer&#039;][&#039;all&#039;] = trim(fgets($con[&#039;socket&#039;], 4096));<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo $con[&#039;buffer&#039;][&#039;all&#039;].&quot;\n&quot;;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(substr($con[&#039;buffer&#039;][&#039;all&#039;], 0, 6) == &#039;PING :&#039;) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cmd_send(&#039;PONG :&#039;.substr($con[&#039;buffer&#039;][&#039;all&#039;], 6));</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } elseif ($old_buffer != $con[&#039;buffer&#039;][&#039;all&#039;]) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // make sense of the buffer<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; parse_buffer();<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (feof($con[&#039;socket&#039;]))<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $old_buffer = $con[&#039;buffer&#039;][&#039;all&#039;];<br />&nbsp; &nbsp; &nbsp; &nbsp; }</p></blockquote></div><p>It SHOULD echo blah constantly, as it is in the while loop, but it doesn&#039;t. Instead, it only echo&#039;s &quot;blah&quot; when the socket receives data.</p><p>I&#039;ve tried to figure this out for a while now, and I can&#039;t. It just makes no sense to me... <br />So, if someone could please help me, I would highly appreciate it <img src="https://punbb.informer.com/forums/img/smilies/big_smile.png" width="15" height="15" alt="big_smile" /></p>]]></description>
			<author><![CDATA[null@example.com (Gary13579)]]></author>
			<pubDate>Mon, 16 Jan 2006 00:23:49 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/60348/#p60348</guid>
		</item>
	</channel>
</rss>
