我有一个数据库,查询时可以返回有时包含网址的结果。如果结果中有地址,它将始终位于数据库的“位置”字段中。
目前,当结果返回时,它会作为一行文本返回(用户必须将其复制/粘贴到浏览器窗口中)。
如何让它返回一个超链接,而不仅仅是一行文本?
这是我的PHP...
if(mysql_num_rows($raw_results) > 0){ // if one or more rows are returned do following
while($results = mysql_fetch_array($raw_results)){
// $results = mysql_fetch_array($raw_results) puts data from database into array, while it's valid it does the loop
echo "<p><strong><u><h2>".$results['SchoolName']."</h2></u></strong>".$results['text']."</p>";
echo "<p><strong>Location:</strong> ".$results['SchoolLocation']."".$results['text']."</p><br />";
echo "<p><strong>Notes:</strong> ".$results['SchoolNotes']."".$results['text']."</p><br /><br /><br />";
// posts results gotten from database(title and text) you can also show id ($results['id'])
}
}
else{ // if there is no matching rows do following
echo "<br /><br /><br /><strong><h2>"."This is great news! The school you searched for is NOT on our Illegitimate High School List..."."</h2></strong>";
}
}
else{ // if query length is less than minimum
echo "Minimum length is ".$min_length;
}
?>
我做了一些研究并发现了这一点,但我不知道如何将其应用于我的情况。