note 44230 added to control-structures.do.while
| From: | roberts83 at navigators dot lv | Date: | Sun, 18 Jul 2004 23:15:29 +0000 |
| Subject: | note 44230 added to control-structures.do.while | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-73581@lists.php.net to get a copy of this message | ||
Please note that for do..while structure there is no alternative syntax.
1. Example snippet:
<?php
echo "<ul>";
do
echo "<li>".$row['listitem'];
while ($row=mysql_fetch_array($result));
echo "</ul>";
?>
The above syntax works fine without curly brackets { }
2. Example snippet:
<?php
do
echo "Name: ".$row['namefield'];
echo "Date: ".$row['datefield'];
while ($row=mysql_fetch_array($result));
?>
The above syntax causes Parse error.
If you love alternative syntax and have more than one line in do..while then make sure that curly
brackets are in place
----
Manual Page -- http://www.php.net/manual/en/control-structures.do.while.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+44230
Delete -- http://master.php.net/manage/user-notes.php?action=delete+44230&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+44230&report=yes
Search -- http://master.php.net/manage/user-notes.php