in reply to if/while/else problem

Hmmm, the snippet you supply isn't anywhere near 54 lines long !!

However, that being said, the while loop appears to be terminated by the else clause, aka you're a } missing !

A user level that continues to overstate my experience :-))