数据库varchar列上的超链接


Hyperlink on database varchar column

我有一个插入到数据库,我插入的文本有<a href=""></a>标签。

mysql_query("INSERT INTO `pm`(`message`) VALUES('You have been Invited to the team hello Click <a href="http://localhost:8080/competitive/accept.php">here</a> to accept.')");

,从列返回的结果是这样的:

You have been Invited to the team hello Click href="http://localhost:8080/competitive/accept.php">here to accept.

我想让它看起来像这样:

You have been Invited to the team hello Click here/*this is an link*/ to accept.

我如何使它正确?

编辑:

完整代码:http://jsfiddle.net/Mvpy8/ps:不运行只看代码

应该可以正常工作:

mysql_query("INSERT INTO `pm` (`message`) VALUES ('You have been Invited to the team ".$team_name." Click <a href='"http://localhost:8080/competitive/accept.php'">here</a> to accept.')");
$result = mysql_query("SELECT `message` FROM `pm` LIMIT 1");
if($row = mysql_fetch_row($result)) {
    echo $row[0];
}

但是你应该使用mysqli而不是mysql。

如果这不起作用,请发布您遇到问题的确切代码!

问题是你使用' and "。试试这个。

mysql_query("INSERT INTO `pm`(`message`) VALUES('You have been Invited to the team ".$team_name." Click <a href='http://localhost:8080/competitive/accept.php'>here</a> to accept.')");