doh85 Posted December 6, 2010 Share Posted December 6, 2010 if($ns_cb->targetCurrency == 'USD') { $usd_base_rate = '1'/$ns_cb->value; } $eq = number_format($usd_base_rate*$ns_cb->value,2); echo $eq $ns_cb->value is currently = 0.9940. But this gets updated every day. I keep getting division by zero for this problem here, any help? Quote Link to comment Share on other sites More sharing options...
bugcoder Posted December 6, 2010 Share Posted December 6, 2010 just add a check before division to ensure it doesnt get divided by zero if(!empty($ns_cb->value)){ $usd_base_rate = '1'/$ns_cb->value; } Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted December 6, 2010 Share Posted December 6, 2010 $ns_cb->value is NOT currently = 0.9940 or you wouldn't get this error. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.