else that wont loop

[php]while(false!== ($file = readdir($res))) {
if(strpos(strtolower($file),$q)!== false &&!in_array($file,$exclude)) {

if (($info[“extension”] == “mp3”) || ($info[“extension”] == “wav”)) {
}else{}
}
}[/php]
the problem is that when i put an error msg in the else of the red code part it loops as much as files that are not mp3 or wave type. so how i can stop that from happening? and if i did put it outside it wont read $file variable. or even is it possible to know how to make another variable that can bring results of my search outside the while loop cuz i tried alot of things but didnt work :S

Thanks in advance,
Maxwel

Without the rest of the code it will be hard for us to help, but at first glance, the first section:

[php]false!==[/php]

Doesn’t look right, what are you trying to do here?

Should it not be:

[php]while(!false($file = readdir($res))) { [/php]

Assuming you are checking that it is not false. I don’t even see the need for not false if you’re using a while loop, you could just use:

[php]while($file = readdir($res)){[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service