0

I have the following code:

<td class="dataTableContent">
<?php
$cuttinglist_weight_query = tep_db_query("select op.orders_id, p.products_id, SUM(p.products_weight) as total_products_weight from " . TABLE_ORDERS_PRODUCTS . " op  left join " . TABLE_PRODUCTS . " p on (op.products_id = p.products_id) where orders_id = '" . (int)$cuttinglist['orders_id'] . "'");
$cuttinglist_weight = tep_db_fetch_array($cuttinglist_weight_query);

echo $cuttinglist_weight['total_products_weight'];

?>

</td>

this prints the Total weight of Order column:

enter image description here

In the box below titled 'total weight to prepare', I need to show the total of the column, anyone have any ideas?

1
  • take a counter , add weight for each record to it , and then display at end Commented Sep 5, 2012 at 12:38

1 Answer 1

2
<td class="dataTableContent">

    <?php
    $cuttinglist_weight_query = tep_db_query("select op.orders_id, p.products_id, SUM(p.products_weight) as total_products_weight from " . TABLE_ORDERS_PRODUCTS . " op  left join " . TABLE_PRODUCTS . " p on (op.products_id = p.products_id) where orders_id = '" . (int)$cuttinglist['orders_id'] . "'");
    $cuttinglist_weight = tep_db_fetch_array($cuttinglist_weight_query);

    echo $cuttinglist_weight['total_products_weight'];

    if(!$totalSum){ $totalSum = 0; }
    $totalSum += $cuttinglist_weight['total_products_weight']
    ?>

</td>

then at the end in your cell just echo it:

<table>
    <tr>
        <td>Total Weight To Prepare</td>
    </tr>
    <tr>
        <td><?php echo $totalSum; ?></td>
    </tr>
</table>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.