本文介绍了MySQL SELECT 查询不区分大小写吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有方法帖子的表单,用户将按品牌日期等过滤结果.如果 MySQL 中的品牌名称存储为非小写示例( samsung )并且搜索输入字段填充为大写示例( SAMSUNG ),它仍然会给我正确的结果还是会导致错误?

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

推荐答案

区域设置为latin1_swedish_ci".

The locale is "latin1_swedish_ci".

因为它以ci"结尾,所以它必须是case-insensitive.

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

这篇关于MySQL SELECT 查询不区分大小写吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-11 03:38