当前位置:Gxlcms > PHP教程 > php多功能搜索_PHP教程

php多功能搜索_PHP教程

时间:2021-07-01 10:21:17 帮助过:30人阅读

$flag=$_POST['flag'];
$sosoval=$_POST['keyword'];
$sosoquery="where 1=1 ";
if(!emptyempty($sosoval)&&$flag!=='-1'){
//$sosoquery.="and (title like '%$sosoval%') or (keyword like '%$sosoval%') or (author like '%$sosoval%')";
if($flag=='1'){
$sosoquery.="and (author like '%$sosoval%')";
}elseif ($flag=='2'){
$sosoquery.="and (title like '%$sosoval%')";
}else{
$sosoquery.="and (keyword like '%$sosoval%')";
}
} $sql="select * from article $sosoquery order by id desc";
$rs=$db->query($sql);
$date=array();
while ($row=$db->fetch_array($rs)){
$date[]=$row;
}
$tpl->assign('soso',$date);
$tpl->assign('appname','信息示例');
$tpl->display('index/up.tpl');

摘自 chaojie2009的专栏

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/478379.htmlTechArticle$flag=$_POST[flag]; $sosoval=$_POST[keyword]; $sosoquery=where 1=1 ; if(!emptyempty($sosoval)$flag!==-1){ //$sosoquery.=and (title like %$sosoval%) or (keyword like %$sosoval%) or (...

人气教程排行