Page 1 of 1

Foreach statements. Returns error if no match.

Posted: Sun Oct 16, 2005 6:09 pm
by Trenchant
I have made a php file manager and in one part I'm using foreach to look for files. The only problem is that if there are no files in a folder(if none have been added yet) then the foreach statement leaves an error. I don't want it to leave an error.

Is there any way to disable it from leaving an error if it doesn't read anything? I don't want to disable errors for the whole page.

Posted: Sun Oct 16, 2005 6:11 pm
by Charles256
count the number of files in folder. if number is greater than 0 execute for each loop else go to the next folder.