$i为1-n。若为a$i的话,如何变成
select * from tbl where `condiction`=`a1` or `condiction`=`a2` or `condiction`=`a3` or ...
这种形式?
select * from tbl where `condiction`=`a1` or `condiction`=`a2` or `condiction`=`a3` or ...
这种形式?
for($i=1;$i<=10;$i++){
$where[]= "`condiction`='a".$i."'";
}
$sql="select * from tbl where ".implode(' or ',$where);
echo $sql;
if($i==1){$str .= "`condiction`=`a".$i."`";}
else{$str .= " or `condiction`=`a".$i."`";}
}$sql = "select * from tbl where ".$str;
echo $sql;