Search code examples
mysqlcase-sensitive

Are MySQL SELECT queries case-insensitive?


I have a form with method post, users will filter results by brand date etc. If the brand name in the MySQL is stored with non lowercase example ( samsung ) and the search input field is filled with uppercase example ( SAMSUNG ) will it still give me the correct results or will cause errors ?

$branded=mysqli_real_escape_string($db, $_GET['brand']); // USER TYPED SAMSUNG
}
$query= "SELECT * FROM `brands` WHERE `brand` = '$branded' LIMIT 1"; // stored as samsung

Solution

  • The locale is "latin1_swedish_ci".

    Because it ends in "ci", it must be case-insensitive.