[!--quoteo(post=363778:date=Apr 11 2006, 03:10 PM:name=Twentyoneth)--][div class=\'quotetop\']QUOTE(Twentyoneth @ Apr 11 2006, 03:10 PM) [snapback]363778[/snapback][/div][div class=\'quotemain\'][!--quotec--] I'm wanting to show the 5 most current upcoming events, the files will be labled 20060401.php, the year month and day in date(Ymd), and it will add a number to date, each time ect until it comes accross a date that is a file....the problem is, nothing shows up, I have echo'd out $file, and the other variables, and they all seem to work, but when it gets to my while and if statements it all stops.... [code]$dir = 'upcoming/'; $date = date('Ymd'); $number = 0; $file= ($dir . $date . ".php"); while($number > 6) { if(is_file($file)) { if($number >= 4) { echo "<a href='index.php?file=" . $date . ".php'>" . $date . "</a><br>"; $number++; $date++; } else { echo "<a href='index.php?file=" . $date . ".php'>" . $date . "</a>"; $number++; $date++; } } else { $date++; } } ?>[/code] [/quote] Hi. I have just scanned through the code quickly, and from it, it seems the while loop is never performed. You are setting $number=0 and then you have while condition to be $number>6 which is never since $number=0 therefore $number<6. It should either be $number <6 or if you want at least one iteration, you should use do...while loop.