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
> Orderlin
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 $tot
either you foreach the $data['Order']['Orderline'] and calculate the
sum of (price * quantity)
or either you add a sum field in your orders table thats is modified
when you add/edit/delete an orderline (maybe by an afterSave callback)
On 26 fév, 18:54, "mike" <[EMAIL PROTECTED]> wrote:
> I have s
I have searched this board high and low and cannot find a solution to
this problem
On Feb 26, 12:24 pm, "mike" <[EMAIL PROTECTED]> wrote:
> I have setup table relations so that Order brings in Orderlines, but
> this leads me to another problem. I somehow need to total the order
> but this isn't a
I have setup table relations so that Order brings in Orderlines, but
this leads me to another problem. I somehow need to total the order
but this isn't as easy as I first thought. I'm wondering if anyone can
give any help on how to do this, probably a for loop i would think?
Thanks very much any
Hi, Thanks for the advise.
In that case I'd have to have a form that wrote to both order and
Orderlines tables??
On Feb 24, 8:28 pm, "djiize" <[EMAIL PROTECTED]> wrote:
> Hi
>
> you need another table, call it orderlines for instance, with these
> fields:
> order_id
> item_id
> quantity
> ... an
Hi
you need another table, call it orderlines for instance, with these
fields:
order_id
item_id
quantity
... and maybe some more
and a belongsTo Order association
When you retrieve an Order, you'll get its Orderlines too
On 24 fév, 16:18, "mike" <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have a
Hi all,
I have a small problem and wonder if I could get some advice on the
best way to overcome it.
What I want is an orders table where I can input data such as items,
order reference, notes, delivery date etc. The table will be linked to
a customer table. What I'm stuck on however if the best