<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: PHP needs a while-else statement</title>
	<atom:link href="http://richardkmiller.com/95/php-needs-a-while-else-statement/feed" rel="self" type="application/rss+xml" />
	<link>http://richardkmiller.com/95/php-needs-a-while-else-statement</link>
	<description></description>
	<lastBuildDate>Wed, 08 Feb 2012 16:07:14 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: PHP Beginner</title>
		<link>http://richardkmiller.com/95/php-needs-a-while-else-statement/comment-page-1#comment-170967</link>
		<dc:creator>PHP Beginner</dc:creator>
		<pubDate>Sun, 10 Jul 2011 18:15:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.richardkmiller.com/blog/?p=95#comment-170967</guid>
		<description>I know hardly anything about website development and found myself needing a while-else statement. Great that we can Google and that I picked this suggested site. Thanks for the previous comments that suggest simple workarounds.</description>
		<content:encoded><![CDATA[<div class='microid-9dafaf866aae70507bc32ea8b52618845c18851c'>I know hardly anything about website development and found myself needing a while-else statement. Great that we can Google and that I picked this suggested site. Thanks for the previous comments that suggest simple workarounds.</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brett Alton</title>
		<link>http://richardkmiller.com/95/php-needs-a-while-else-statement/comment-page-1#comment-168456</link>
		<dc:creator>Brett Alton</dc:creator>
		<pubDate>Mon, 11 Apr 2011 18:19:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.richardkmiller.com/blog/?p=95#comment-168456</guid>
		<description>I was just hoping for this functionality about 5 minutes ago. There is obvious workarounds, but this would be much much cleaner.</description>
		<content:encoded><![CDATA[<div class='microid-0ea2f87d3eb84159a17b663d6a9b26fcbab3b6cd'>I was just hoping for this functionality about 5 minutes ago. There is obvious workarounds, but this would be much much cleaner.</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: smarecha</title>
		<link>http://richardkmiller.com/95/php-needs-a-while-else-statement/comment-page-1#comment-164557</link>
		<dc:creator>smarecha</dc:creator>
		<pubDate>Thu, 23 Dec 2010 11:20:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.richardkmiller.com/blog/?p=95#comment-164557</guid>
		<description>Woops, wrong move...like i was saying :
A solution (simpler than taaniel’s one) is to put a flag :

$hasresult=false;
while($row=mysql_fetch_assoc($mysqlResult)){
        [do whatever you want]
        $hasresult=true;
}
if(!$hasresult){
        [do whatever you want]
}</description>
		<content:encoded><![CDATA[<div class='microid-dcb0b121a0ee8060a6d7ffa78e0fb2d9f19751ec'>Woops, wrong move&#8230;like i was saying :<br />
A solution (simpler than taaniel’s one) is to put a flag :</p>
<p>$hasresult=false;<br />
while($row=mysql_fetch_assoc($mysqlResult)){<br />
        [do whatever you want]<br />
        $hasresult=true;<br />
}<br />
if(!$hasresult){<br />
        [do whatever you want]<br />
}</p></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: smarecha</title>
		<link>http://richardkmiller.com/95/php-needs-a-while-else-statement/comment-page-1#comment-164556</link>
		<dc:creator>smarecha</dc:creator>
		<pubDate>Thu, 23 Dec 2010 11:18:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.richardkmiller.com/blog/?p=95#comment-164556</guid>
		<description>A solution (simpler than taaniel&#039;s one) is to put a flag :
$hasresult=false;
while($row=mysql_fetch_assoc($mysqlResult)){

}</description>
		<content:encoded><![CDATA[<div class='microid-dcb0b121a0ee8060a6d7ffa78e0fb2d9f19751ec'>A solution (simpler than taaniel&#8217;s one) is to put a flag :<br />
$hasresult=false;<br />
while($row=mysql_fetch_assoc($mysqlResult)){</p>
<p>}</p></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: php developer</title>
		<link>http://richardkmiller.com/95/php-needs-a-while-else-statement/comment-page-1#comment-160899</link>
		<dc:creator>php developer</dc:creator>
		<pubDate>Mon, 11 Oct 2010 08:57:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.richardkmiller.com/blog/?p=95#comment-160899</guid>
		<description>There is a feature request to this:
&lt;a href=&quot;http://bugs.php.net/bug.php?id=26411&quot; rel=&quot;nofollow&quot;&gt;Request #26411 - while {} else {}&lt;/a&gt;

There is also a feature request for the corresponding foreach statement:
&lt;a href=&quot;http://bugs.php.net/bug.php?id=46240&quot; rel=&quot;nofollow&quot;&gt;Request #46240 - Build in foreach else support&lt;/a&gt;

Please visit and vote!
No registration or additional details required to vote.
You can subscribe or comment in the &#039;Add Comment&#039; tab by just adding your mail, no registration needed.</description>
		<content:encoded><![CDATA[<div class='microid-3e4dfb7c9cc4c7cd597882e59a73ba67e061439b'>There is a feature request to this:<br />
<a href="http://bugs.php.net/bug.php?id=26411" rel="nofollow">Request #26411 &#8211; while {} else {}</a></p>
<p>There is also a feature request for the corresponding foreach statement:<br />
<a href="http://bugs.php.net/bug.php?id=46240" rel="nofollow">Request #46240 &#8211; Build in foreach else support</a></p>
<p>Please visit and vote!<br />
No registration or additional details required to vote.<br />
You can subscribe or comment in the &#8216;Add Comment&#8217; tab by just adding your mail, no registration needed.</p></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: hwk</title>
		<link>http://richardkmiller.com/95/php-needs-a-while-else-statement/comment-page-1#comment-158794</link>
		<dc:creator>hwk</dc:creator>
		<pubDate>Tue, 14 Sep 2010 02:54:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.richardkmiller.com/blog/?p=95#comment-158794</guid>
		<description>how do i do it here?

while(!(connection_aborted() &#124;&#124; connection_status() == 1) &amp;&amp; $bytes_sent content_length)

		{

//this sends data

		if(connection_aborted() &#124;&#124; connection_status() == 0) {log_write(&quot;Seems the client aborted the file download&quot;); break;}


}</description>
		<content:encoded><![CDATA[<div class='microid-ea0d2f14436c397386bb7428f2aa94900f21d694'>how do i do it here?</p>
<p>while(!(connection_aborted() || connection_status() == 1) &amp;&amp; $bytes_sent content_length)</p>
<p>		{</p>
<p>//this sends data</p>
<p>		if(connection_aborted() || connection_status() == 0) {log_write(&#8220;Seems the client aborted the file download&#8221;); break;}</p>
<p>}</p></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jacques</title>
		<link>http://richardkmiller.com/95/php-needs-a-while-else-statement/comment-page-1#comment-149483</link>
		<dc:creator>Jacques</dc:creator>
		<pubDate>Wed, 16 Jul 2008 20:04:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.richardkmiller.com/blog/?p=95#comment-149483</guid>
		<description>I wholeheartedly agree, here&#039;s something that I&#039;ve considered using that represents the while-else. The only problem is if you change the list=fetch line, you have to do it twice.

if (list($a,$b) = mysql_fetch_row($result)) {
    do {
        process($a,$b);
    } while (list($a,$b) = mysql_fetch_row($result));
} else {
    print &quot;No results returned&quot;;
}</description>
		<content:encoded><![CDATA[<div class='microid-e0db050b50f3ce784e0b89ea84a2d8646a822f11'>I wholeheartedly agree, here&#8217;s something that I&#8217;ve considered using that represents the while-else. The only problem is if you change the list=fetch line, you have to do it twice.</p>
<p>if (list($a,$b) = mysql_fetch_row($result)) {<br />
    do {<br />
        process($a,$b);<br />
    } while (list($a,$b) = mysql_fetch_row($result));<br />
} else {<br />
    print &#8220;No results returned&#8221;;<br />
}</p></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: redcore</title>
		<link>http://richardkmiller.com/95/php-needs-a-while-else-statement/comment-page-1#comment-5825</link>
		<dc:creator>redcore</dc:creator>
		<pubDate>Mon, 21 Aug 2006 20:19:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.richardkmiller.com/blog/?p=95#comment-5825</guid>
		<description>I definitely agree. In fact, I was just trying to just that and upon that not working I googled it and realized it doesn&#039;t exist. It&#039;s a common sense statement, if you ask me (hence why I tried doing it). I reckon a post on php.net&#039;s forum would be a good way of seeing why this cannot be done and if it can, give it some thought and perhaps enough traction to be implimented.</description>
		<content:encoded><![CDATA[<div class='microid-dcff0331ed3a4e640ce419421fe4cb8cf408d279'>I definitely agree. In fact, I was just trying to just that and upon that not working I googled it and realized it doesn&#8217;t exist. It&#8217;s a common sense statement, if you ask me (hence why I tried doing it). I reckon a post on php.net&#8217;s forum would be a good way of seeing why this cannot be done and if it can, give it some thought and perhaps enough traction to be implimented.</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richard K Miller dot coooooooooom &#187; PHP 5 and Beyond</title>
		<link>http://richardkmiller.com/95/php-needs-a-while-else-statement/comment-page-1#comment-5534</link>
		<dc:creator>Richard K Miller dot coooooooooom &#187; PHP 5 and Beyond</dc:creator>
		<pubDate>Thu, 17 Aug 2006 05:34:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.richardkmiller.com/blog/?p=95#comment-5534</guid>
		<description>[...] while-else statement &#8212; A while-else statement would be perfect for MySQL results: loop through the results, or if there were no results display an error. [...]</description>
		<content:encoded><![CDATA[<div class='microid-ecff17fa4224e07cf34bbd539687e5740f504ed4'>[...] while-else statement &#8212; A while-else statement would be perfect for MySQL results: loop through the results, or if there were no results display an error. [...]</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: taaniel</title>
		<link>http://richardkmiller.com/95/php-needs-a-while-else-statement/comment-page-1#comment-641</link>
		<dc:creator>taaniel</dc:creator>
		<pubDate>Tue, 21 Feb 2006 08:12:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.richardkmiller.com/blog/?p=95#comment-641</guid>
		<description>agreed, but alternative way is use one variable and if after while, for example

$q = mysql_query(&#039;SELECT * FROM tbl&#039;);
$n = 0;
while($r = mysql_fetch_assoc($q))
{
// do something
++$n
}
if(0 == $n)
{
    // no rows found
}</description>
		<content:encoded><![CDATA[<div class='microid-bf83cedc27713b5e0b9f0f3bcb3d34272cc6cddd'>agreed, but alternative way is use one variable and if after while, for example</p>
<p>$q = mysql_query(&#8216;SELECT * FROM tbl&#8217;);<br />
$n = 0;<br />
while($r = mysql_fetch_assoc($q))<br />
{<br />
// do something<br />
++$n<br />
}<br />
if(0 == $n)<br />
{<br />
    // no rows found<br />
}</p></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: joel alexandre</title>
		<link>http://richardkmiller.com/95/php-needs-a-while-else-statement/comment-page-1#comment-640</link>
		<dc:creator>joel alexandre</dc:creator>
		<pubDate>Tue, 21 Feb 2006 00:00:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.richardkmiller.com/blog/?p=95#comment-640</guid>
		<description>PHP doesn&#039;t support that, but Smarty does.  

I normally use 
foreach / else   to display tables.</description>
		<content:encoded><![CDATA[<div class='microid-213ad883b6a20b3d6a6b508f8e362495c83bed1e'>PHP doesn&#8217;t support that, but Smarty does.  </p>
<p>I normally use<br />
foreach / else   to display tables.</p></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gustavo Narea</title>
		<link>http://richardkmiller.com/95/php-needs-a-while-else-statement/comment-page-1#comment-639</link>
		<dc:creator>Gustavo Narea</dc:creator>
		<pubDate>Mon, 20 Feb 2006 21:42:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.richardkmiller.com/blog/?p=95#comment-639</guid>
		<description>+1.

Any PHP developer there?</description>
		<content:encoded><![CDATA[<div class='microid-328557ead5106e0855d27c2936b46643b5771d64'>+1.</p>
<p>Any PHP developer there?</p></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex Kadis</title>
		<link>http://richardkmiller.com/95/php-needs-a-while-else-statement/comment-page-1#comment-638</link>
		<dc:creator>Alex Kadis</dc:creator>
		<pubDate>Mon, 20 Feb 2006 20:57:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.richardkmiller.com/blog/?p=95#comment-638</guid>
		<description>Interesting thought, I am inclined to agree with you, however I do not know what would go into making something like this happen, and I have no idea if it is even feasible. Perhaps someone with more knowledge on the subject will chime in.</description>
		<content:encoded><![CDATA[<div class='microid-e70fdcb4b17a327fa9f4c4886c701fc8368e50e3'>Interesting thought, I am inclined to agree with you, however I do not know what would go into making something like this happen, and I have no idea if it is even feasible. Perhaps someone with more knowledge on the subject will chime in.</div>
]]></content:encoded>
	</item>
</channel>
</rss>

