PHP SQL Server
$wd1=$_POST['wd1']; //原来是这样真心,不会了啊。。求教。。提前感谢各位!!
$where = "1=1";$arr = array('col1','col2','col3');foreach($split_dir AS $key=>$val){ $where .= " AND ".$arr[$key]." LIKE '%".$val."%' ";}
嗯。。谢谢我试试
嘿嘿好了。。。。。我是这样写的
$wd1=$_POST['wd1'];
$split_dir = split ('[ ]',$wd1);
$arr = array('编码','名称','类别','型号');
$where2=" ";
for($m=0;$m
{
for($n=0;$n
if($n==(count($arr)-1)){
$where2=$where2.$arr[$n]." like '%".$split_dir[$m]."%'";
}else{
$where2=$where2.$arr[$n]." like '%".$split_dir[$m]."%' or ";
}
}
$where2=$where2." ";
}else{
for($n=0;$n
if($n==(count($arr)-1)){
$where2=$where2.$arr[$n]." like '%".$split_dir[$m]."%'";
}else{
$where2=$where2.$arr[$n]." like '%".$split_dir[$m]."%' or ";
}
}
$where2=$where2." ) and ( ";
}
}