在数据库表中,列name是varchar(255)
列上的编码:utf8_unicode_ci
列中的示例值:Garner Heating & Cooling
当我查询这个值时,使用:
$conn = new mysqli($host, $user, $pw, $db);
$sql = "SELECT id,name FROM bizs WHERE name = 'Garner Heating & Cooling'";
if ($result = $conn->query($sql)) {
if ($conn->affected_rows > 0) {
while ($row = $result->fetch_assoc()) {
echo "OLD Name: " . $row['name'] . "\n";
}
}
}
输出: OLD Name: Garner Heating & Cooling
为什么&被转换为&?
倚天杖
红颜莎娜