查询数据 结果集逗号分割

$brandres = $db->select("select brand_id,brand_name from ecs_brand where $partamemter and is_show = 1 and brand_name like '%$keyword%'");
if(!empty($brandres)){
    $brand_id = '';
  foreach($brandres as $k => $v){
  if($k){
    $brand_id .= ",".$v->brand_id;
  }else{
    $brand_id .= $v->brand_id;
  }
}

$brand_id = ltrim($brand_id,',');

$condition .= " or brand_id in($brand_id) ";
}

转载于:https://www.cnblogs.com/nonoleng/p/7762137.html

你可能感兴趣的:(查询数据 结果集逗号分割)