Two columns: English and Metric.
Then just do a select metric where english = 6 1/8 (my pseudo-SQL) with MySQL and get the length. I suspect there are only a limited number of standard lengths and this would work nicely.
You could also do a standard mathematical metric-english conversion and then round to the nearest five. That might do the trick also, it would require less data input but there is the slight chance (you'd have to check examples) that you'll find some instance in which it produces the incorrect number. The trickier part will be going in the opposite direction, although that too is manageable.
Good luck!
-Galen
On Mar 27, 2004, at 6:55 PM, Karl Timmermann wrote:
Hi,
I am working on a PHP/MySQL solution to have a webpage where users can rate cigars. I ran into a problem though. One variable that exists is the length of the cigar. In the cigar world, the lengths are usually written like 6 1/8" or 155 mm or 4 15/16" or 125 mm. I don't want to make the length column in the database be a string with data like "6 1/8"" in it, because as the user submits cigars, different users could type it a different way, screwing up searches that are searching by length. I also want to have a real time metric conversion as well.
So my question is, how should I do this? Should I have a float column with the lengths as mm and it converts it to inches? If so, then how would I convert 155.57500mm to 6 1/8", or 155mm to 6 1/8". It's hard to explain, but I can't come up with a good solution. Please ask if you need clarification.
Any help is much appreciated!
Thanks! Karl
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php