AJAY RAGHUVANSHI
AJAY RAGHUVANSHI

Reputation: 31

MYSQL replies differently for similar queries

I am using xamp server:

when I am running the select query to get data as

SELECT `id`, `relation`, `member_id`, `Relative_id` 
    FROM `relationship` WHERE `relation` = 'माँ'

All works fine

But when running below example of queries I get 0 results.

Example 1 :

SELECT `id`, `relation`, `member_id`, `Relative_id` 
    FROM `relationship` WHERE `relation` = 'बेटी'

Example 2 :

SELECT `id`, `relation`, `member_id`, `Relative_id` 
    FROM `relationship` WHERE `relation` = 'पिता'

the image regarding db table

click here Table structure:table structure

Upvotes: 3

Views: 57

Answers (2)

tony gil
tony gil

Reputation: 9554

You must use a Unicode character set (utf8_unicode_ci works fine), declare the field as VARCHAR and use LIKE, instead of =

SELECT `id`, `relation`, `member_id`, `Relative_id` 
FROM `relationship` WHERE `relation` LIKE 'पिता';

Tested and working.

Upvotes: 2

Ravi
Ravi

Reputation: 31407

You need to use UTF-8 encoding to compare language.

Use mysqli_set_charset

Upvotes: 1

Related Questions