简体   繁体   中英

Ignore Case Sensitive in SQL LIKE

$keyword = $_POST['searchKeywords'];

$query = mysqli_query($con, "SELECT * FROM movie WHERE title LIKE '%$keyword%' LIMIT 5");

I'm getting $keyword from the input field via POST request.And I have to type the accurate title like 'The Order' with the same case sensitive So I should type the exact way it is.Is there any way to type with any case sensitive I want like 'the order' and get the result.I will appreciate your help thanks.

In MySQL string comparison can be case sensitive or case insensitive. This normally depends on the collation used not on operator (where, like).

Read how case sensitivity works

i think you can apply that function first on the keyword variable before you use it

strtolower("Hello WORLD.");

you will get it as: hellow world.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM