我有一个脚本,下面显示的信息从我的网页上的MySQL数据库读取,我怎么能使匹配的结果加粗?例如,如果我搜索“john”如何使显示结果为“john blogs”。感谢php mysql搜索脚本,如何使匹配结果大胆
这里是脚本到目前为止,
<?
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/>';
}
?>
拜托,这里是脚本? – ajreal