PHP-Nut Posted November 12, 2007 Share Posted November 12, 2007 I have a list of products in a database and show the price based on a calculation of cost+vat * markup all is working fine until the result would be 4 figures in front of the decimal point. then it returns 1 (or 0.99 as is my code) <?php echo round(number_format($row_newprodRst['price']*1.175*$row_newprodRst['mup'],2))-0.01; ?> for example if the result = 999.99 then thats fine Anything that would result in a higher number fails and shows 0.99 ( ???) Im sure there is a simple answer Paul. Link to comment https://forums.phpfreaks.com/topic/76980-whats-wrong-with-this-code/ Share on other sites More sharing options...
Dragen Posted November 12, 2007 Share Posted November 12, 2007 try doing the number format after the round. It may be that the ',' mucks up the rounding. not sure though.. Link to comment https://forums.phpfreaks.com/topic/76980-whats-wrong-with-this-code/#findComment-389785 Share on other sites More sharing options...
PHP-Nut Posted November 12, 2007 Author Share Posted November 12, 2007 Yes that Seams to Work..... Strange Thanks Paul. Link to comment https://forums.phpfreaks.com/topic/76980-whats-wrong-with-this-code/#findComment-389962 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.