ZeroSuf3r
ZeroSuf3r

Reputation: 2001

php query(lowercase/uppercase letters) validate

I need select result from mysql regarding query string. Let's string will be: Z and z (uppercase and lowercase)

How database look like:

url_id      test_char
1           Z
2           z

Ok, in address bar entered: localhost/z This query always selecting 1 result, first one, so it returns always 1. If i try even z.

The test_char is varchar.

How to make Z and z select diferrent results ?

Upvotes: 0

Views: 1762

Answers (3)

KingRider
KingRider

Reputation: 2257

My opinion is best use function MD5 (PHP and SQl are work)

Look a example: How to make a SELECT in PHP/MySQL case insensitive?

Sorry bad english!

Upvotes: 0

Jason McCreary
Jason McCreary

Reputation: 73031

MySQL uses case insensitive searching by default for non binary strings or certain collation types.

Per OMG Ponies note, you could adjust this at the DB or Table level. Alternatively, you could adjust it inline for your specific query. Examples of each are in the docs linked above.

Upvotes: 1

Aditya Avaga Purwa
Aditya Avaga Purwa

Reputation: 43

If you are using XAMPP go to localhost/phpmyadmin/ and access your database and change it to Case Sensitive.

Upvotes: 0

Related Questions