Re: Changing case
| From: | David Otton | Date: | Wed, 12 Nov 2003 17:32:01 +0000 |
| Subject: | Re: Changing case | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-169320@lists.php.net to get a copy of this message | ||
On Wed, 12 Nov 2003 11:29:10 -0500, you wrote:
>I have a form that allows for an item to be entered, the other pieces
>have been fixed so far that were bogging me down, but now I am looking
>for a way to convert any entry in the form to be UPPER case so that when
>the quote is listed, they are alphabetical.
>
>The problem is if someone enters aa-1234 and the other items in the
>quote are FF-2345 and QQ-3456 then the aa-1234 is UNDER them, instead of
>on top.
Rather than upper-casing all your data, how are you sorting it?
I would expect your database to do a case-insensitive sort by default...
SELECT column from table ORDER BY column
should return
abc
ABC
def
DEF
or you could use a case-insensitive sort function, eg
http://www.php.net/manual/en/function.natcasesort.php
(though there are others).
Of course, if you want everything upper-case for consistency rather than
ordering, forget everything I just said.