<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://script.spoken-tutorial.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=PHP-and-MySQL%2FC2%2FLoops-While-Statement%2FEnglish</id>
		<title>PHP-and-MySQL/C2/Loops-While-Statement/English - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=PHP-and-MySQL%2FC2%2FLoops-While-Statement%2FEnglish"/>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=PHP-and-MySQL/C2/Loops-While-Statement/English&amp;action=history"/>
		<updated>2026-04-06T01:15:23Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.17</generator>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=PHP-and-MySQL/C2/Loops-While-Statement/English&amp;diff=3771&amp;oldid=prev</id>
		<title>Pravin1389: Created page with '{| border=1 !Time !Narration |- |0:00 |okay i have decided to do each looping tutorial in a different video because i don't want to confuse anyone. |- |0:07 |i want to keep it si…'</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=PHP-and-MySQL/C2/Loops-While-Statement/English&amp;diff=3771&amp;oldid=prev"/>
				<updated>2013-04-20T20:24:55Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;#039;{| border=1 !Time !Narration |- |0:00 |okay i have decided to do each looping tutorial in a different video because i don&amp;#039;t want to confuse anyone. |- |0:07 |i want to keep it si…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{| border=1&lt;br /&gt;
!Time&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
|0:00&lt;br /&gt;
|okay i have decided to do each looping tutorial in a different video because i don't want to confuse anyone.&lt;br /&gt;
|-&lt;br /&gt;
|0:07&lt;br /&gt;
|i want to keep it simple and also for a reference perhaps if you need to come back and refer to how a particular loop is initialized.how it works.then this i find it much easier to have a separate video&lt;br /&gt;
|-&lt;br /&gt;
|0:22&lt;br /&gt;
|okay so what we are going to do is we gonna use a while loop&lt;br /&gt;
|-&lt;br /&gt;
|0:25&lt;br /&gt;
|now a while loop checks for condition at the start at the loop and executes the code depending on whether this condition is true or not&lt;br /&gt;
|-&lt;br /&gt;
|0:35&lt;br /&gt;
|so for example what I'm gonna do is I'm gonna start my 'while loop' and I'm gonna say this my condition and this my block&lt;br /&gt;
|-&lt;br /&gt;
|0:44&lt;br /&gt;
|I'll represent it well my block is in between some curly brackets&lt;br /&gt;
|-&lt;br /&gt;
|0:52&lt;br /&gt;
|okay my condition here.now the thing with this is ,in the last,in the 'if statement' example i used 1=1.&lt;br /&gt;
|-&lt;br /&gt;
|1:02&lt;br /&gt;
|now if I was to say 'test' or 'loop' here.&lt;br /&gt;
|-&lt;br /&gt;
|1:08&lt;br /&gt;
|okay there is loop here and then a brake,now what this would do is,as long as 1=1 it would create a loop &lt;br /&gt;
|-&lt;br /&gt;
|1:14&lt;br /&gt;
|now if i do wrong my brown.so I man you can try these if you want.&lt;br /&gt;
|-&lt;br /&gt;
|1:19&lt;br /&gt;
|it would probably crash your browser because loop would be repeated as long as 1=1 and which i am afraid is forever.1 will always equal 1&lt;br /&gt;
|-&lt;br /&gt;
|1:29&lt;br /&gt;
|so therefore loop will always be repeated therefore your browser will be crashed&lt;br /&gt;
|-&lt;br /&gt;
|1:33&lt;br /&gt;
|so what I can say is I can say while a variable let say 'num' is smaller or equal to 10 and what i can do is under my echo i can say 'num ++'&lt;br /&gt;
|-&lt;br /&gt;
|1:57&lt;br /&gt;
|now '++' is a arthematical operator.i dint cover my arthematical operator tutorial and what is basically does is it increases 1,it is same as writing 'num =num +1'&lt;br /&gt;
|-&lt;br /&gt;
|2:16&lt;br /&gt;
|so its taking this and its saying that it is equal to the value of it currently at 1 more.&lt;br /&gt;
|-&lt;br /&gt;
|2:22&lt;br /&gt;
|okay so this again is a arthematical operator. so basically in our program this is gonna happen&lt;br /&gt;
|-&lt;br /&gt;
|2:29&lt;br /&gt;
|we are gonna say is 'num' smaller than or equal to2:46 '10'.if so echo loop and then say add 1 on to the valuable&lt;br /&gt;
|-&lt;br /&gt;
|2:46&lt;br /&gt;
|but what we should really do is create 'num = to 1' at the moment.so loop once at 1 this will then equal 2 then 3 then 4 all the way up to 10 then in which case it will stop&lt;br /&gt;
|-&lt;br /&gt;
|3:02&lt;br /&gt;
|and then the rest of the code below this will continue&lt;br /&gt;
|-&lt;br /&gt;
|3:06&lt;br /&gt;
|so we said this 1 and see what will we get. okay we got loop 1,2,3,4,5,6,7,8,10 times&lt;br /&gt;
|-&lt;br /&gt;
|3:20&lt;br /&gt;
|okay now to make it more fun I'm going to say loop 1 and I'm gonna concatenate 'num' on the end of that&lt;br /&gt;
|-&lt;br /&gt;
|3:29&lt;br /&gt;
|In fact let's be sensible about it and say 'num' inside that it will make it easier to read&lt;br /&gt;
|-&lt;br /&gt;
|3:37&lt;br /&gt;
|okay so I'm gonna say loop 1 and add 1 and then I'll say loop 2 and I'll add another one that's loop 3 add another one bla-bla-bla&lt;br /&gt;
|-&lt;br /&gt;
|3:49&lt;br /&gt;
|lets open this up refresh it there you go, you got loop 1,2,3 all the way up to 10 like you can see&lt;br /&gt;
|-&lt;br /&gt;
|3:57&lt;br /&gt;
|so you can change this value here to 100 if you like.refresh that.you can see it has gone to hundred.now the bigger you make it the longer it will take&lt;br /&gt;
|-&lt;br /&gt;
|4:09&lt;br /&gt;
|let's over 6000.let's refresh that.it's gonna take a while and there you go up to six thousand.so it's very efficient in this way&lt;br /&gt;
|-&lt;br /&gt;
|4:20&lt;br /&gt;
|if you leastwise if you can try combining this with an 'array' to create a program that echoes out of the alphabet inside the 'array'&lt;br /&gt;
|-&lt;br /&gt;
|4:33&lt;br /&gt;
|you can use loops to echo out every single value of an array&lt;br /&gt;
|-&lt;br /&gt;
|4:36&lt;br /&gt;
|just give it a go if you fancy it it would probably be in one my tutorial not in the basics section and I probably would do something like that&lt;br /&gt;
|-&lt;br /&gt;
|4:45&lt;br /&gt;
|however,this is the basics structure. what I also recommend you to do is create a variable here called 'max' and have your maximum value here&lt;br /&gt;
|-&lt;br /&gt;
|4:54&lt;br /&gt;
|he will do exactly the samething it's just a lot more easy to read and you can declare all this thing up here and this would be a reference to it&lt;br /&gt;
|-&lt;br /&gt;
|5:02&lt;br /&gt;
|just in case you have more than 1 loop. I prefer it for readability and flexibility for my program.okay so that a while loop and I'll just overview it checks the condition of the start&lt;br /&gt;
|-&lt;br /&gt;
|5:15&lt;br /&gt;
|if that condition is true. it would execute this block of code and you can do things like 'echo alpha'&lt;br /&gt;
|-&lt;br /&gt;
|5:21&lt;br /&gt;
|your variable is been implemented.make sure that you do implement your variable otherwise it will loop for infinity.&lt;br /&gt;
|-&lt;br /&gt;
|5:31&lt;br /&gt;
|okay thanks for watching&lt;br /&gt;
|-&lt;/div&gt;</summary>
		<author><name>Pravin1389</name></author>	</entry>

	</feed>