Re: How to make it case sensitive?
| From: | David Bullock | Date: | Sat, 22 Sep 2001 01:09:27 +0000 |
| Subject: | Re: How to make it case sensitive? | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-12650@lists.php.net to get a copy of this message | ||
On Fri, 21 Sep 2001 14:28:52 -0400, jpstech@unoh.edu (Jason Stechschulte)
wrote:
>On Fri, Sep 21, 2001 at 05:02:14PM +0100, Denny Suvanto wrote:
>> The script is just fine until I notice that the
>> username is case insensitive. So, if a member has a
>> username "andy" he can log in using
>> "andy", "Andy", "aNdY", "andY", and so on. I also
>> notice that I can't enter a new member with username
>> "Andy", "anDY", and so on as they will duplicate the
>> existing "andy". Is this the natural behaviour of
>> MySQL or is there anyway to make it case sensitive?
>> I'm using PHP 4.0.6 & MySQL 3.23.39.
>
>You have to make the column case sensitive, binary will accomplish this.
>Something like:
>
>username varchar(20) binary
Another way to tackle the problem is to store the data into field in a set case
by running strtoupper or strtolower on the data before you store it or retrieve
it. It will also likely require less CPU power than running a fuzzy regexp
based search.
- Dave