gpt4 book ai didi

php - 使用 PHP 强制 MySQL 字段小写

转载 作者:行者123 更新时间:2023-11-29 04:11:21 24 4
gpt4 key购买 nike

我有一个带有电子邮件字段的数据库,它循环遍历数据库以获取与某个电子邮件地址有关的所有交易。

当他们的电子邮件以几个大写形式存储时,用户输入小写字母会导致它不显示他们的交易。当我修改它以与其他电子邮件完美匹配时,它就起作用了。

我如何修改它,以便它可以正确地与电子邮件字段进行比较并且不区分大小写?是否会改变电子邮件的存储方式?

$result = mysql_query("SELECT * FROM `example_orders` WHERE `buyer_email`='$useremail';") or die(mysql_error());

提前致谢!

最佳答案

呃...您知道电子邮件地址是区分大小写的,,对吗?来自 RFC 2821 :

Verbs and argument values (e.g., "TO:" or "to:" in the RCPT command
and extension name keywords) are not case sensitive, with the sole
exception in this specification of a mailbox local-part (SMTP
Extensions may explicitly specify case-sensitive elements). That is, a command verb, an argument value other than a mailbox local-part,
and free form text MAY be encoded in upper case, lower case, or any
mixture of upper and lower case with no impact on its meaning. This
is NOT true of a mailbox local-part. The local-part of a mailbox
MUST BE treated as case sensitive.
Therefore, SMTP implementations
MUST take care to preserve the case of mailbox local-parts. Mailbox
domains are not case sensitive. In particular, for some hosts the
user "smith" is different from the user "Smith". However, exploiting the case sensitivity of mailbox local-parts impedes interoperability
and is discouraged.

(强调)

关于php - 使用 PHP 强制 MySQL 字段小写,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10019594/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com