(SELECT goods_id, name, img, price, hits, new, sale FROM goods WHERE visible='1' AND goods_brandid IN(?,?)) UNION (SELECT goods_id, name, img, price, hits, new, sale FROM goods WHERE goods_brandid IN (SELECT brand_id FROM brands WHERE parent_id IN(?,?) ) AND visible='1' AND price BETWEEN 0 AND 10000) AND price BETWEEN 0 AND 10000) ORDER BY name
$arr = array(1,2,3);
$in = str_repeat('?,', count($arr) - 1) . '?';
$sql = "SELECT * FROM table WHERE column IN ($in)";
$stm = $db->prepare($sql);
$stm->execute($arr);
$data = $stm->fetchAll();