Vinu
Vinu

Reputation: 167

How to perform a case in-sensitive search on a case sensitive MySQL database?

How to perform a case in-sensitive search on a case sensitive MySQL database?
For example, name = Test & name = test.
then the query returns both Test & test.
How to make a query for this..??

Upvotes: 0

Views: 74

Answers (2)

slash197
slash197

Reputation: 9034

$query = "SELECT * FROM table WHERE LOWER(name) = '" . strtolower($name) . "'";

Upvotes: 1

juergen d
juergen d

Reputation: 204746

try

select * from your_table
where `name` = 'test'
COLLATE latin1_general_ci 

or

select * from your_table
where `name` = 'test'
COLLATE utf8_general_ci

Upvotes: 3

Related Questions