query("select id from ecmproducts"); while($r=$GLOBALS['db']->fetchByAssoc($w)){ $sql = "update ecmproducts set commission_rate=(srp_price/(1+vat_value/100)-purchase_price)/(srp_price/(1-vat_value/100)); where id='".$r['id']."'"; $GLOBALS['db']->query($sql); } ?>