|
if($cata!=""){
if(in_array("cell",$cata)){
$this->db->or_where("cell","1");
}
if(in_array("equipment",$cata)){
$this->db->or_where("equipment","1");
}
if(in_array("installer",$cata)){
$this->db->or_where("installer","1");
}
if(in_array("integrator",$cata)){
$this->db->or_where("integrator","1");
}
if(in_array("material",$cata)){
$this->db->or_where("material","1");
}
if(in_array("component",$cata)){
$this->db->or_where("component","1");
}
if(in_array("panel",$cata)){
$this->db->or_where("panel","1");
}
if(in_array("product",$cata)){
$this->db->or_where("product","1");
}
}
if($key!=""){
$this->db->like($condition,$key);
}
if($continent!=""){
$this->db->where("basic.continent",$continent);
}
if($region!=""){
$this->db->where("region_en",$region);
}
$cata是复选框的数组,代表厂家的生产类型,$key是关键字,如公司名,ID,EMAIL什么的,$condition是关键字的类型,也就是字段名,$continent是哪个州,$region是国家地区。
比如我搜索亚洲的panel和product,那么sql语句应该是where $continent='apac' and ( $cata = panel or $cata = product),但CI没有为$cata的where子句中加括号,于是就成了where $continent='apac' and $cata = panel or $cata = product ,这样就不是搜索亚洲中的公司类型。我如何给cata类型的where子句中加上括号 |
|