PHP對於數據庫的搜索主要通過使用SQL語句中的like子句來實現
<?php require_once(
<?php
$colname_rs = $_GET[
$result = explode(
mysql_select_db($database_conn
//根據多個關鍵詞構建SQL語句
$query_rs =
for($i=
{
if($i==
$query_rs
OR content LIKE
else //對其他關鍵詞
$query_rs
}
$query_rs
//執行SQL語句
$rs = mysql_query($query_rs
$row_rs = mysql_fetch_assoc($rs);
$totalRows_rs = mysql_num_rows($rs);
?>
<html>
<head>
<title>Search</title>
<meta http
</head>
<body>
<form name=
<div align=
<input name=
<input type=
</div>
</form>
<p align=
<?php
for($i=
echo $result[$i]
}
?></B></p>
<p><hr></p>
<?php if($totalRows_rs>
<p>* <a href=
$row_rs[
$row_rs[
<?php } while ($row_rs = mysql_fetch_assoc($rs)); ?>
</body>
</html>
<?php
mysql_free_result($rs);
?>
這裡
http://develop
圖
這裡
From:http://tw.wingwit.com/Article/program/PHP/201311/21411.html