I have to display values from three mysql tables(package,supplier,requests).
table :package
Table : Supplier
Table: requests
i want to display final result like this
Final Result
this is the query what i have tryed.
$query= "SELECT package.p_name, supplier.cat, supplier.cat_action,requests.cat_action, package.cost_for_cat, package.leads_per_month, package.package_price
FROM package
LEFT JOIN supplier
ON package.category = supplier.cat
AND supplier.email='".$_SESSION["mail"]."'
LEFT JOIN requests
ON package.package_id = requests.package_id
GROUP BY requests.package_id
ORDER BY package.package_id DESC
";
$result= mysql_query($query);
$sum = 0;
while($row = mysql_fetch_assoc($result))
{
echo '<tr >';
echo '<td>'.$row['p_name'].'</td>';
echo '<td>'.$row['cat'].'</td>';
echo '<td>'.'<I>'.$row['cat_action'].'</I>'.'</td>';
echo '<td>'.'£ '.$row['cost_for_cat'].'</td>';
echo '<td>'.$row['leads_per_month'].'</td>';
echo '<td style="text-align:right;">'.'<label id="pprice">'.'£ '.$row['package_price'].'</label>'.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td> </td>';
echo '<td> </td>';
echo '<td> </td>';
echo '<td> </td>';
echo '<td>TOTAL</td>';
echo '<td style="text-align:right;">'.'£ '.'<label id="pprice">'.$sum += $row['package_price'].'</label>'.'</td>';
echo '</tr>';
}
but it's display result like this