我有一个插入数据库,我插入的文本有<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:不要运行只看代码。
答案 0 :(得分:0)
这应该按预期工作:
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。
如果这不起作用,请发布您遇到问题的确切代码!
答案 1 :(得分:0)
问题在于你使用'和'。试试这个。
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.')");