[thelist] sql order by sizes

Hassan Schroeder hassan.schroeder at gmail.com
Sat Jul 7 17:30:36 CDT 2007


On 7/7/07, der wert <derwert at hotmail.com> wrote:
> What I would do is use integers in the database and then in the page you're
> outputting the data create an array
>
> sizes[1]="Sm";
> sizes[2]="Med";
> sizes[3]="Lg";

which also has the advantage of allowing easy localization, if
you want to render your pages in other languages.

Alternative: non-portable, but if you're using MySQL, change the
size column to something like
  size ENUM("sm","med","large","XL","2XL","4XL");

Then a `SORT BY size` will use your specified ordering.

HTH,
-- 
Hassan Schroeder ------------------------ hassan.schroeder at gmail.com



More information about the thelist mailing list