[SOLVED] closest number?
Posted: Mon Jun 14, 2004 11:38 am
Hey,
I have a problem.
I have a DB table with a collume in witch i saved numbers.
1.123
1.234
4.67854
...
I need to get the number that is closest or equal to 2.3. In that example 1.234.
How do I do that? If I use like or = in a MySQL DB query I get just a replay if 2.3 is in the DB, but not the closest.
I looked a usort, but i wasen't able to do it.
greetings an thanks
shark86
I have a problem.
I have a DB table with a collume in witch i saved numbers.
1.123
1.234
4.67854
...
I need to get the number that is closest or equal to 2.3. In that example 1.234.
How do I do that? If I use like or = in a MySQL DB query I get just a replay if 2.3 is in the DB, but not the closest.
I looked a usort, but i wasen't able to do it.
greetings an thanks
shark86