我在下面有一个脚本,它从我的网页上的 mysql 数据库中读取显示的信息,请问如何使匹配的结果加粗?例如,如果我搜索“john”,如何使显示的结果为“ john bloggs”。谢谢
这是到目前为止的脚本,
<?
mysql_connect ("localhost", "user","pass") or die (mysql_error());
mysql_select_db ("databasename");
$term = $_POST['term'];
$sql = mysql_query("select * from tablename where category like '%$term%' or title like '%$term%' or postcode like '%$term%' or info like '%$term%' ");
while ($row = mysql_fetch_array($sql)){
echo '<br/> Category: '.$row['category'];
echo '<br/> Title: '.$row['title'];
echo '<br/> Address: '.$row['add1'];
echo '<br/> Street: '.$row['street'];
echo '<br/> City: '.$row['city'];
echo '<br/> Postcode: '.$row['postcode'];
echo '<br/> Phone: '.$row['phone'];
echo '<br/> E-Mail: '.$row['email'];
echo '<br/> Website: '.$row['website'];
echo '<br/><br/>';
}
?>