Found this answer and seems to work.

$sum = 0;

foreach($result as $row)
{
        $sum += $row['price'];

}  Thanks Mariano


On Feb 28, 1:39 pm, "mike" <[EMAIL PROTECTED]> wrote:
> Thanks very much fo the reply.
>
> I currently have the simple code below printing out of the values in
> Orderlines.
>
> foreach ($item as $index=>$row) {
>
> $price = $row['price'];
> $qty = $row['qty'];
>
> $total = $price*$qty;
>
> echo $price;
> echo $qty;
> echo $total;
>
> }
>
> What I'd like to do next is add all $total in as many rows it prints.
> Simple enough but not sure how.
> I think I need to add a unique variable to $total on each loop then
> add then all up when it breaks out of the loop (????)
> Does anyone have an example I could look at?
>
> Thanks very much for the help so far!
>
> Mike.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to