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']. "')");
精彩评论