while($row = mysql_fetch_assoc($sql)):
$i++;
if(checkKod($i)):
$size = isset($sizes[$row['id']]) ? $sizes[$row['id']] : $S_1_s1;
if(($row['price'] * $size)!=0):
$pdf->Row(
array(
$row['id'],
$row['name'],
$size,
$row['type'],
$row['price'],
$row['price'] * $size
)
);endif;
endif;
endwhile;
$row['price'] * $size
<?php
$all_price = array();
while($row = mysql_fetch_assoc($sql)):
$i++;
if(checkKod($i)):
$size = isset($sizes[$row['id']]) ? $sizes[$row['id']] : $S_1_s1;
$sum = $row['price'] * $size;
if($sum != 0):
$pdf->Row(
array(
'id' => $row['id'],
'name' => $row['name'],
'size' => $size,
'type' => $row['type'],
'price' => $row['price'],
'sum' => $sum
)
);
$all_price [] = $sum;
endif;
endif;
endwhile;
echo array_sum($all_price);
while($row = mysql_fetch_assoc($sql)):
$i++;
if(checkKod($i)):
$size = isset($sizes[$row['id']]) ? $sizes[$row['id']] : $S_1_s1;
$sum = $row['price'] * $size;
if($sum != 0):
$pdf->Row(
array(
'id' => $row['id'],
'name' => $row['name'],
'size' => $size,
'type' => $row['type'],
'price' => $row['price'],
'sum' => $sum
)
);
endif;
endif;
endwhile;
SELECT * FROM table_with_products
SELECT t1.id,t1. name, t1.type, t1.price, t2.size, t1.price* t2.size as sum
FROM table_with_products as t1
INNER JOIN table_with_sizes as t2
ON t1.id = t2.id_from_table_with_products
WHERE t1.price* t2.size > 0
while($row = mysql_fetch_assoc($sql)){
$pdf->Row(
array(
'id' => $row['id'],
'name' => $row['name'],
'size' => $size,
'type' => $row['type'],
'price' => $row['price'],
'sum' => $sum
)
);
}