Re: Unable to do a calculation
Posted: 2013-11-18 21:00
Hi all,
I can't believe I have been trying to do this for soooo long without success....
I tried this from AhmedBR:
my 4 table fields form mysql are:
id
unit
price
total
The math should be:
Toal = price * unit;
Please help....I wish I could work it out but both solutions do not work for me.
I tried many different variations without success.
Thank you,
Ben
I can't believe I have been trying to do this for soooo long without success....
I tried this from AhmedBR:
my 4 table fields form mysql are:
id
unit
price
total
The math should be:
Toal = price * unit;
Code: Select all
function cost_before_insert(&$data, $memberInfo, &$args){
$id=$data['id'];
$vtotal=$data['units']*$data['price'];
sql("update total set total='$vtotal' where id='$id'");
return TRUE;
}
I tried many different variations without success.
Thank you,
Ben