Page 1 of 1

Upper / Lower case ?

Posted: Wed Mar 28, 2007 8:08 am
by WorldCom
Hi all,

This is more of an observation without explanation :)
I have a login script using a Domain Name and Password for login.
Eg. test.com

This compares the domain name input to the domain name in the database.
What I did was use:

Code: Select all

$domainname = strtolower($domainname);
> to make sure everything was in lower case when logging in.
My problem (which doesn't really seem to be a problem) is that when users sign up, they may use caps in their domain name. Even though we know it makes no difference. eg. TesT.com
So, in the database it is logged exactly that way.

Yet, I can log in to these domains (with Upper case) when my input should be all lower case.
It logs in fine.
Does MySQL not differentiate between upper and lower?

Posted: Wed Mar 28, 2007 8:22 am
by volka
Depends on the datatype and/or the collation.
see http://dev.mysql.com/doc/refman/5.1/en/ ... ivity.html

Posted: Wed Mar 28, 2007 8:39 am
by WorldCom
Thanks volka,

Exactly what I was looking for.
So, for the configuration I have, my changing the domainname input to lower case is kinda useless.
So my setup is fine for me cause it makes things easier and I can get rid of that line :)

Posted: Wed Mar 28, 2007 10:05 am
by s.dot
or you could just lowercase them before you insert them into the database :P