想要在查询中访问$ catarray的数据

时间:2014-10-29 10:46:45

标签: php

SELECT PM.*, promotion_type.type_name, country.country_name, province.province_name, 
  region.region_name, towncity.towncity_name FROM promotion As PM
       join country on PM.country_id=country.id
       join province on PM.province_id=province.id
       join region on PM.region_id=region.id
       join towncity on PM.towncity_id=towncity.id
       join promotion_type on PM.promotion_type=promotion_type.id 
       where PM.category_id in('".$catarray."')";

1 个答案:

答案 0 :(得分:0)

使用$catarray时,这可能会帮助您 -

 PM.category_id in('".implode(",", $catarray."'))

$array = array('lastname', 'email', 'phone');
$comma_separated = implode(",", $array);

echo $comma_separated; 

输出将是 - lastname,email,phone