Jump to content

nested while only loops outer?


kev@num

Recommended Posts

hi, i've got a list called $words which I am looping through should ECHO one of these to the browser

and for each one of these I want to  show a list of filenames which should be made from the second - inner loop.

 

what happens is:

 

the first echo shows and then the inner loop runs but only runs once..

 

it doesn't run the inner loop for the second echo

 

 

<?php

while (list(, $value) = each($words)) {
echo $value ."<br>";




				while(false != ($file = readdir($dir))){
				if(($file != ".") and ($file != "..")){

				echo "<font color='red'>".$file ."</font><br>";

				}
				}




}
?>

 

 

any help would be much appreciated..

do i need to reset the inner loop after each run somehow?

Link to comment
https://forums.phpfreaks.com/topic/196494-nested-while-only-loops-outer/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.