New Zenner
- Join Date:
- Aug 2007
- Posts:
- 16
- Plugin Contributions:
- 0
Please could I have help with a function
Hi there everyone,
If anyone's passing here please could you help me with a function to multiply 2 values from the same table to give a new value.
This is what I've done but cant seem to make it work.
I do appreciate that I may well have got this wrong so could someone correct this for me.
(I've tried to work it out by studying other functions)
So if I wanted to multiply products_price by products_quantity to give products_sumtotal would I do it like this?
<?php function zen_get_products_sumtotal($products_price, $products_quantity) { global $db; $products_sumtotal = $db->Execute("SELECT $products_price * $products_quantity from " . TABLE_PRODUCTS . " where products_ourprice = '" . (int)$products_price . "' and products_quantity = '" . (int)$products_quantity . "'"); return $products_sumtotal->fields['products_sumtotal']; } ?>Many thanks