Character Case Problems

So I have my login form in my website.

And for example my username is JuvarAbrera (saved in mysql).

When I try to login using this username ---> juvarabrera

It is still logged-in in my website. Now, I want it NOT to logged-in because of the the J and A are uppercased.

So, how can I do that? I think I explained it very well.

Thanks. :)

Answers


You can collate the value in the query:

SELECT `id` FROM `users` WHERE `username` = 'php_value' COLLATE utf8_general_cs

Change column collation to utf8_bin (i.e. when using utf8_general_ci)

Take care of *_general_* collations because comparisions base on language rules. So have a look

in utf8_general_ci the following is true: 'a'='A', 'ä'='A' in utf8_general_cs the following is true: 'Ä'='A' in utf8_bin none of these is true, and I think that's what you want


The following SQL query will allow for upper-cased names:

SELECT * 
FROM   login 
WHERE  uname         = '$username' AND 
       BINARY(uname) = BINARY('$username')

Need Your Help

How do you pass strings in C#?

c# string

How do you pass strings in C#?

Placing ViewPager as a row in ListView

android android-layout listview android-fragments android-widget

I try to use ViewPager as a row ins ListView but a get a bizarre behaviuor - Only the first row works, but when I scroll the list it disappears. When I scroll an empty row, suddenly the row above is