[英]registered symbol is killing me
我的数据库中有一个单元格,其中保存有类似于Intel®
的文本Intel®
而且我还有一个复选框,其值是Intel®
因此,当我将查询中的复选框值发送到php时,查询最终像这样
SELECT something from products WHERE company="Intel(®)";
我放了'Intel®'
在我的数据库中,因为我在其他地方回显了它,所以希望您了解发生了什么
再过一次,该复选框的值为Intel®
但是当我将此值放入查询中时,查询最终像这样结束
SELECT * from products WHERE company="Intel(®)"
在要发送到SQL语句的字符串上,首先将其通过htmlentities
传递。
首先看一下PHP手册:
<?php
$orig = "I'll \"walk\" the <b>dog</b> now";
$a = htmlentities($orig);
$b = html_entity_decode($a);
echo $a; // I'll "walk" the <b>dog</b> now
echo $b; // I'll "walk" the <b>dog</b> now
复选框的值为“Intel®”而不是“ Intel&reg;”。
“&章;” 只是在HTML中表示®符号的一种方法。 如果您希望该值为“ Intel&reg;” 您需要使用“&amp;”转义“&”号
将html编码值存储在数据库中会导致诸如此类的各种问题,因此,我将考虑是否需要存储所有转义值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.