Comment

Steve Holden

Of course normally you would define a function that used float() and int() along with exception handling to do exactly what you needed, just like you did with ValidHeight. The real question (no pun intended) is why you are storing them in the database as floating point numbers when you are validating them as integers. It's that discrepancy that gives rise to the problem in the first place.

Replies

Peter Bengtsson

The reason we stored them as real was because in this particular application we reuse the same sql table for storing the answers to all questions in a complex questionnaire and part of it was a slightly off-topic question about the users height and weight.