Now there a is good example of a do while loop:
Code:
<?php
# This sample code by Wallpaperama.com
# This is a loop that displays a list of numbers 1 through 10
$number_of_loops = 10;
$counter = 1;
do
{
echo $counter.'<br>';
# Increment $counter by 1
$counter ++;
}
# NOTES: The next line checks to see if the number of loops is greater than or equal to ten,
# if its not, then it continues with the loop until the number of loops is more than 10
while ($counter <= $number_of_loops);
?>
# This sample code by Wallpaperama.com
# This is a loop that displays a list of numbers 1 through 10
$number_of_loops = 10;
$counter = 1;
do
{
echo $counter.'<br>';
# Increment $counter by 1
$counter ++;
}
# NOTES: The next line checks to see if the number of loops is greater than or equal to ten,
# if its not, then it continues with the loop until the number of loops is more than 10
while ($counter <= $number_of_loops);
?>
if you want to see how this code looks, open your text editor like notepad in Windows and save the file as loop.php, then upload to your PHP website and open it with your browser, when you open the loop.php file with your browser, it will display like this:
Code:
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
Remeber, if you need PHP web hosting, visit our friends at www.webune.com