Jump to content

Convenient One-shot Way To Select Value Irrespective Of Case


chibineku
 Share

Recommended Posts

I want to allow users to register with their username/email address in any combination of upper and lower case characters they like, but to check at registration, login and account management instances that no e-mail address with the same username/email address exists irrespective of case. I am aware that I can use LOWER() in mysql queries, but if I tried, for example:"SELECT id FROM aromaMaster WHERE email = '".strtolower($email)."'";that would only work if I did strtolower on insertion, right? Can I make the WHERE email clause case insensitive?

Link to comment
Share on other sites

That was what I thought, but I just figured that would never work - it's never that easy. I am really impressed overall with the thought that the developers of MySQL put into it - there is a simple way of doing everything. Just consider the simple logic of ON DUPLICATE KEY UPDATE for an example.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...