Hi there,
try something along these lines:
SELECT columnName, ABS(columnName - 9) AS distance
ORDER BY distance LIMIT 1
Could be that ORDER BY won't accept alias distance in which case you'll have to repeat the ABS() code. The trick is in calculating the distance of your number (9) and your column values.
In PHP you then use something like:
$result = mysql_query("SELECT ... ABS(columnName - $myNumber) ...");
list($closestNumber) = mysql_fetch_row($result);
Let me know if this helps.
Petr 'PePa' Pavel