query("SELECT code, name, SUM(quantity) AS qty FROM ecmsaleitems WHERE ecmsale_id IN ('".implode("','", $ids)."') GROUP BY ecmproduct_id ORDER BY code"); $t = ''; while ($r = $db->fetchByAssoc($res)) $t.=''; $t.='
KodNazwaIlość
'.$r['code'].''.$r['name'].''.$r['qty'].'
'; echo $t; ?>