如何显示包含“&”值的 mysql 表中的记录


How to display the records from mysql table which is containing the '&' value

在我的mysql表中,我需要检索一些记录并在页面中显示它们,但是我的表有一个名为公司的列,当我被查询并显示值而不是AT和T时,它包含一个名为AT和T的值如何解决这个问题?

这是我尝试过的

update tests set stages='"$stages'", channel='"$channel'", remarks='"$remarks'",owner='"$owner'",date1='"$modified_on'",action_item='"$acti‌​on_item'" where (organization='"$organization'" && id='"$rider_id'" && first_name='"$first_name'")";

这是我用于根据公司名称进行更新的命令,但由 &在公司名称中组成的值不会更新

您需要转义值。例如,如果您使用的是 mysqli:

    //escape and htmlspecialchars
    $stages = mysqli_real_escape_string($link, htmlspecialchars($stages));
    $channel= mysqli_real_escape_string($link, htmlspecialchars($channel));
    etc...