Storing length or height in database in a way that won’t drive users crazy

We’re trying to store something like a height or length in a database, such as feet inches. I cannot figure out the best way to approach this that stores clean data, but is also easy for the admin interface user to work with.

Example

5' 7"

I’m anticipating that I’ll need to sort by it later on as part of a search result function, but stored that way, it’s a string.

What seems most logical to me is to store the value as inches (numeric) in the database, but calculating that conversion to a single numeric value is far too much work for the people who will be using this content management system.

There’s also the concern that users may type it out any of several ways:

5' 7"

5'7"

5' 7''

5’ 7”

5‘ 7“

Don’t ask why…we all know people do stupid things.

We’re using Advanced Custom Fields on top of WordPress, so I could build a “length” or “height” field type for use in this situation, which would handle any calculations necessary for the user, but I probably need a good plan of attack for the solution before attempting to build out the add-on.

Racking my brains trying to figure how to best archive this data. Any solutions are appreciated.

Leave a Reply

*

Hire Me
Follow Me!
Search
Most Popular Articles & Pages
Because your vote is Important
Sorry, there are no polls available at the moment.
Categories