[thelist] 1.1.2 Sorting

David U. davidu at everydns.net
Fri Dec 6 13:31:00 CST 2002


Feingold Josh S wrote:

> We have a list that is currently stored as a text field since it
> isn't a true number (e.g. 1.1.2, 1.1.3).  Is there any way to sort
> this?

Josh,

The kind of sorting you want is called "natural ordering".

PHP has a natural ordering algorithm built in via the natsort() function.

http://php.net/natsort

It's rather trivial to do this in code, rather annoying and error prone to
do in SQL.

Hope that helps,
davidu





More information about the thelist mailing list