This while loop does nothing due to your typo at the end there.
Remove the semi-colon.
As things stand this loops until there are no records, and then you go into the next couple of lines where you then try and print out the non-existent record.
What's wrong? Where are you going? Stop! Read this tiny ad:
a bit of art, as a gift, that will fit in a stocking