I need to find a way in which to find a field in a database which; numerically, is the closet match to what a user has inputted in a web form and submitted.
In a database table there are two rows with a field entry of 80.1 and 80.7. If a site user enters 80 into an input element on a web form and submits that value, the handling script looks up that table and finds a row with 80.1 and chooses this as the closet match.
If it was the other way round, i.e. the user entering a floated integer (80.6), the table looking for the nearest rounded number i.e. (90) that would be easy. I'm obviously missing something and thought there would be an in built function in PHP for this.
Apologies if I have not explained myself well, if so please let me know.