开发者

LCASE where search

I'd like to search using the WHERE statement, but case-insensitive. I was told I could use LCASE(), but how would I do this with the following?

mysql_query("SELECT * FROM table WHERE f开发者_开发问答ieldt = '" .$_POST['thisf']. "'");


You can trick it witht making both (field and needed data) in Upper/Lover case:

mysql_query("SELECT * FROM table WHERE UCASE(fieldt) Like UCASE('" .strtoupper($_POST['thisf']). "')");


Assuming I did not introduce a bunch of syntax errors:

mysql_query("SELECT * FROM table WHERE lcase(fieldt) = lcase('" .$_POST['thisf']. "')");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜