mysql 中不区分大小写的查询

问题描述:

我需要查询我的数据库并找到结果:

i need to query my database and find results :

mysql_query("select * from ".ALU_TABLE." where username like '%$q%' or name like '%$q%'");

如果我的表格中有一个名称,例如 Book 并且我在搜索框中输入 book,它不会显示该 Book

if i have a name in my table such as Book and i enter book in search box it wont show the Book

我需要查询我的数据库,因为不区分大小写.

i need to query my database as not to be case sensitive.

你可以使用LOWER()函数

... WHERE LOWER(username) LIKE blabl OR LOWER(name) LIKE asdasd