我有一個腳本,下面顯示的信息從我的網頁上的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