首頁 >php教程 >php手册 >php 多功能搜索

php 多功能搜索

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB原創
2016-06-13 10:47:421196瀏覽

$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的专栏

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn