note 44230 deleted from control-structures.do.while by tomsommer
| From: | tomsommer@php.net | Date: | Mon, 19 Jul 2004 00:33:09 +0000 |
| Subject: | note 44230 deleted from control-structures.do.while by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-73582@lists.php.net to get a copy of this message | ||
Note Submitter: roberts83@navigators.lv
----
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