do while loop learn programming do while loop example code scripts tutorial

Mobile
feeds
Welcome Login | Register

do while loop learn programming do while loop example code scripts tutorial
Reply Your Comments:
Click this button if you are interested in replying to this topic and leave your comments
Sent To Friend
CLick this button if you want to send this page to a friend.
Subsribe To Rss Feeds
Subscribe to RSS
CLick this button if you want to subscribe to this RSS Feed. You can use your browsers feeds burners if you have mozilla or internet explorer 7 or higher and keep up with updates.
  Forums Index
      » PHP Forums
        » » do while loop learn programming do while loop example code scripts tutorial
do while loop learn programming do while loop example code scripts tutorial
Post Description: do while loop learn programming do while loop example code scripts tutorial PHP
Post Tags:
This Post Has Been Viewed 2652 Times Since Sat Mar 31, 2007 3:14 pm Author unix with 28 replies
Next Post »» Simple Array Example Learn PHP Programming Creating Arrays Learn Tutorial
do while loop learn programming do while loop example code scripts tutorial
Advertise On This Page




this short tutorial is to show you how you can display information or data with the DO WHILE loop. I will be using php for this. for this sample code to work, you will need php on your website. if you don't have php already, you can visit our friends at webune.com and signup for a php web hosting plan. They have excellent service and i always recommend them to all my customers.

Now there a is good example of a do while loop:

<?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);
?>


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:

1
2
3
4
5
6
7
8
9
10


Remeber, if you need PHP web hosting, visit our friends at www.webune.com


Leave Your Comments

Your Name
Your Email Address (Will Not Be Published)
Notify Me When Someone Replies to this Page
(An email will be sent to you when someone replies to your comments)
Your Comments
Include A Picture with your comments
Share
| More
Share this page by putting this URL in your comments to other websites like myspace, Facebook, Twitter friendster, Hi5, Groups, Boards, Forum or others. Just Copy and Paste this Code
URL:
To embed this topic, just copy the code from the "Embed" box. Once you've copied the code, just paste it into your website or blog to embed it.
Embed:
BBCODE is use on forums. You can put this code on all your BBCODE enabled forums like PhpBB, vBulletin® and others. Just Copy and Paste this code on your Posts and Replies on your forums
BBCODE:
Subscribe Feeds
Webmasters - Exchange Links With Us. Add related websites to this topic
Add Link:
Links Related to : do while loop learn programming do while loop example code scripts tutorial

Comments and replies About do while loop learn programming do while loop example code scripts tutorial
:: 1 :: Reply #44278 Reply By kate On Wed Mar 05, 2008 6:02 am
kate:
thank you vary much to your good example in do while loop!!!!! i have now assignment in do while loop!!!!!!! thank you again............ bye...........
:: 2 :: Reply #51257 Reply By sumaramesh On Tue Apr 22, 2008 9:49 pm
sumaramesh:
yeah this site is good......
ready scripts 2 understand
loops
:: 3 :: Reply #73781 Reply By recel On Sat Oct 04, 2008 1:10 am
recel:
please help me to create code using while loop. this is the problem.
create a program that enable the user to input 4 numbers using while loop and then display the sum of even and odd number and count the number of even and odd number inputted by the user...
:: 4 :: Reply #73782 Reply By recel On Sat Oct 04, 2008 1:13 am
recel:
please help me to create code using while loop. this is the problem.
create a program that enable the user to input 4 numbers using while loop and then display the sum of even and odd number and count the number of even and odd number inputted by the user... i need your help guyz before monday
:: 5 :: Reply #84613 Reply By evan On Wed Dec 03, 2008 7:40 pm
evan:
please help me about this..please give me a code..do while:

1
a
2
a
a
:: 6 :: Reply #88995 Reply By Agnes On Mon Jan 05, 2009 11:08 pm
Agnes:
example for do while loop
:: 7 :: Reply #90291 Reply By marlon On Fri Jan 16, 2009 11:37 pm
marlon:
i was looking for sample code for html(looping an odd number but this will help,

thanks
:: 8 :: Reply #93421 Reply By ERWIN On Tue Feb 10, 2009 12:03 am
ERWIN:
pls help me:in sample code loops and statement
:: 9 :: Reply #95863 Reply By krystal On Tue Mar 03, 2009 5:54 pm
krystal:
pls help me find an example of do while loop statement
:: 10 :: Reply #96041 Reply By looping On Thu Mar 05, 2009 10:00 am
looping:
show me a loop even numbers
:: 11 :: Reply #96444 Reply By gianlyn On Sun Mar 08, 2009 4:38 pm
gianlyn:
please help me to create a program using do-while loop that the will ask the user tol input y4 numbers and that will count the even number....please help me...thanks,,
:: 12 :: Reply #98202 Reply By robel On Tue Mar 24, 2009 10:58 pm
robel:
please help me to create a program using while loop.with a flowchart and source code. this is the problem
create a program that enable the user to input 3 numbers and count the number of inputted odd and even numbers.
help me..i need this tomorrow march z3.
thank you! god bless!
:: 13 :: Reply #111371 Reply By khen On Sun Aug 02, 2009 12:54 am
khen:
ui help me amn d2 sa for loop statement n2 e2 output
1

333

5555550
:: 14 :: Reply #113626 Reply By julie On Sun Aug 23, 2009 11:05 pm
julie:
ow common ! cant have any good examples from you guys! hmp! thankx a lot men!
:: 15 :: Reply #114489 Reply By cLaui On Wed Sep 02, 2009 1:23 am
cLaui:
huhu...ang hirap! help grabe....ang hirap mag programmm!!
:: 16 :: Reply #114490 Reply By cLaui On Wed Sep 02, 2009 1:27 am
cLaui:
'isa pa pla....
patulong nman how to create a program with looping
:: 17 :: Reply #115241 Reply By On Thu Sep 10, 2009 3:12 pm
:
help to make a programm
]
:: 18 :: Reply #115260 Reply By eugene On Thu Sep 10, 2009 7:31 pm
eugene:
please help me how to create a program that will determine if the input number is even or odd please......
:: 19 :: Reply #115574 Reply By benhur On Mon Sep 14, 2009 9:12 pm
benhur:
14-1005--youm-me-at-six.jpg
please help me to create code using while loop. this is the problem.
create a program that enable the user to input 4 numbers using while loop and then display the sum of even and odd number and count the number of even and odd number inputted by the user...
:: 20 :: Reply #116857 Reply By tyrone On Wed Sep 30, 2009 4:56 pm
tyrone:
please,help me create a program using any of the iterative statements in this problem:
y.input 3 numbers and determine the even and the odd number among the three.
:: 21 :: Reply #117238 Reply By Clang On Mon Oct 05, 2009 9:43 pm
Clang:
please help me to do a java while sample, for statement, do statement and do while statement
:: 22 :: Reply #118471 Reply By jhas On Wed Oct 21, 2009 11:49 pm
jhas:
22-1005-jhas.jpg
hi there,,,will you please give me more examples of do while looping more as you can,,thanks a lot
:: 23 :: Reply #120174 Reply By egitues On Wed Nov 11, 2009 4:04 am
egitues:
write a programe to accept the 4 no to use do loop or while loop
:: 24 :: Reply #121739 Reply By gege On Fri Nov 27, 2009 8:16 pm
gege:
.guday.,
pls help me to ceate code using do-while loop statement.,
tnx
:: 25 :: Reply #123541 Reply By rachel On Wed Dec 16, 2009 8:01 pm
rachel:
make a program that will display the word computer on the screen using loop statement..like this..
c
co
com
comp much!!!!
:: 26 :: Reply #126304 Reply By michael On Tue Jan 19, 2010 8:26 pm
michael:
help me make a do while loop program of c and translate to c .
:: 27 :: Reply #128266 Reply By khemoh On Tue Feb 16, 2010 12:46 am
khemoh:
hi...please help me how to display a while loop to translate it in do while loop....hmm thanks...
:: 28 :: Reply #128267 Reply By keempe On Tue Feb 16, 2010 1:14 am
keempe:
16-1005-1.jpeg
please help me how to fix my face.....XD can you please share your face to me...please....(. ._)