Help me where is the error? I could'n find it. pls!


#1



<!DOCTYPE html>
<html>
    <head>
		<title>Your First PHP while loop!</title>
	</head>
	<body>
    <?php
	$loopCond = true;
	while ($loopCond == true){
		//Echo your message that the loop is running below
		echo "<p>The loop is running.</p>";
	$loopCond = false;
	{
	echo "<p>And now it's done.</p>";
	}	
    ?>
    </body>
</html>


#2

Hi this line

echo "<p>And now it's done.</p>";

Should be outside the while loop

while (condition) { #open the while loop
    #do something
    #put it equale to false
}#close the whille loop

#3

Hi
thanks your reply, but it is not working,not responding whether the code is correct or incorrect
this is my code again,







<?php
$loopCond = true;
while ($loopCond = true){

	echo "<p>The loop is running.</p>";
$loopCond = false;
}
    echo "<p>And now it's done.</p>";
?>
</body>


#4

remove {

$loopCond = false;
{ // remove it
echo "

And now it's done.

";
}

#5

hi,
see my scrnshot, it is not responding, I can not find why is that..


#6

refresh the browser ! :slight_smile:
and use

while($loopcond){

}


#7

Hi,
thanks a lot dear,, now it is working,,
this is the error... I put only one equal sign,that is why..
" while($loopcond){

} "
thanks again :slight_smile:


#8

you can use it too

while ($loopCond == true)


#9

yes.. I tried both way.. thanks :slight_smile: