Q: Am having difficulty displaying data in a table using SQL Aggregate Function SUM() I tried to use the SQL Aggregate Function SUM () and it successfully but i can't seem to be able to display this in a table
Below is my php code i tried it with
`$sql = " SELECT product_name, sum(unit_price_before_discount)
        FROM transaction_sell_lines
        GROUP BY product_name";     
         <!-- TABLE CONSTRUCTION -->

        <table>

            <tr>

                <th>Product Name</th>

                <th>Quantity</th>

                <th>Unit Price</th>

                <th>Current Value</th>

            </tr>

            <!-- PHP CODE TO FETCH DATA FROM ROWS -->

            <?php 

                // LOOP TILL END OF DATA

                while($rows=$result->fetch_assoc())

                {

            ?>

            <tr>

                <!-- FETCHING DATA FROM EACH

                    ROW OF EVERY COLUMN -->

                <td><?php echo $rows['product_name'];?></td>

                <td><?php echo $rows['quantity'];?></td>

                <td><?php echo $rows['unit_price_before_discount'];?></td>

                <td><?php echo ($rows['unit_price_before_discount'])*$rows['quantity'];?></td>

            </tr>

            <?php

                }

            ?>

        </table>`

This is the result i get
And this is my database structure
What i want to do is to add all the values in quantity that has the same name together and display in a table
