Home  >  Article  >  Backend Development  >  php搜索站内数据库,请教

php搜索站内数据库,请教

WBOY
WBOYOriginal
2016-06-02 11:32:421173browse

php数据库搜索

我想做一个搜索站内数据库的搜索框,
写好了之后打开空空如也,连搜索框和按钮都没有
请问是咋回事
代码如下




搜索

include("conn.php");
$db=new mysql('localhost','root','','sjzl','utf8');
if($_GET[key]){
$sql="select * from message where showname like '%$_GET[key]'";
$result=mysql_query($sql);
while($arr= mysql_fetch_array($result)){
$arr[showname]=preg_replace("/($_GET[key])/i","\1",$arr[showname]);
echo $arr[showname];
}
echo $arr[showname];
}
?>

关键字:


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn