Hi,
I have below code to populate items from basket table. I want to know is it possible to calculate the item_quantity TD and show the total_sum or I should do it at MySQL level?
Thanks,
Jassim Rahma
- <div id="divBasket" style="background-color: #FFFFFF; margin-top: 50px; margin-right: 120px; border: 1px solid; border-radius: 25px; padding: 10px; width: 300px; float: right;">
- <table width="100%" cellspacing="10">
- <?php
- $session_id = $_SESSION["id"];
- $mysql_query = $mysql_connection->prepare('CALL sp_populate_basket_items(:param_session_id)');
- $mysql_query->bindParam(':param_session_id', $session_id, PDO::PARAM_STR);
- $mysql_query->execute();
-
- while($mysql_row = $mysql_query->fetch())
- {
- ?>
- <tr>
- <td class="item_name"><?php echo $mysql_row["item_name"]; ?></td>
- <td class="item_quantity"><?php echo $mysql_row["item_quantity"]; ?></td>
- <td class="item_price"><?php echo $mysql_row["item_price"]; ?></td>
- </tr>
- <?php } ?>
- <tr>
- <td colspan="3"><hr></td>
- </tr>
- <tr>
- <td align="right">Total :</td>
- <td></td>
- <td>TOTAL_SUM_FROm_JQUERY</td>
- </tr>
- <tr>
- <td align="center" colspan="3"><img src="images/buy_now.png"></td>
- </tr>
- </table>
- </div>