Incidentally, everything up to while ($row...
can be rewritten as follows:
SELECT p.product_name
, p.birim
, SUM(p.quantity) total
FROM urun u
JOIN product p
ON p.product_name = u.urun
AND p.quantity > 0
AND p.grup != 'uygulama'
AND p.skt > CURDATE()
GROUP
BY p.product_name
, p.birim;
0
solved Calculate SUM in PHP