So what is the query, cos what you show ain't gonna work. If this script ain't showing the values in the text boxes then you've got to prove there is any data to display before you worry about your code not displaying it. I personally don't think there is any data in the first place = nothing for me to 'debug'
Debugging 101
Don't use the @ error suppression operator until your code goes live - then always use it
Always echo out the query to see what you are sending to the db BEFORE you send it.
Always echo out the num rows returned to check if you've got anything to display.
Use additional echos to track the values and execution of all control structures - work your way down through the code like that.
Do that and you'll have enough information to debug this.