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

前端 未结 7 933
面向向阳花
面向向阳花 2020-12-06 11:55

Her\'s my probleme, i guess its really basic.

I\'m trying to lookup in the database if a line does exist. heres my code :

$req=\"SELECT * FROM INSTIT         


        
7条回答
  •  孤城傲影
    2020-12-06 12:34

    you can solve it using "LIKE" as other people told you, BUT it is important to know that the case sensitivity is determined by the collation in the database. For example if you select a collation utf8_general_ci... that "ci" at the end means "case insensitive" so the comparisons you do in the future will be case insensitive.

    In a few words: you have to be careful about the collation you select.

提交回复
热议问题