OK I have a database with a table containing four columns. Each column has many records all with times of day entered with the mySQL TIME data type.
How do I go about querying the database and returning the time value nearest to the current time of day please?
I have it set up so that I have a simple webform that takes a user input of which column the user wants. I want the TIME value nearest to the current time from the chosen column returned to the user.
COLUMN1 COLUMN2 COLUMN3 COLUMN4
11:00 11:40 11:25 11:35
12:05 12:25 12:35 12:25
etc
So if the user enters "3" into the webform and the current time is 12:10 I'd like the 12:35 value returned to them.
I have been Googling and I believe I need to use CURTIME(). I don't want an answer for how to take the user input and use it to query which column. I just need to know how to return a column's time value closest to the current time please! Thank you.