<?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>Fri, 05 Mar 2010 18:03:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<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>
