fazzfarrell Posted May 21, 2007 Author Share Posted May 21, 2007 ooops nt quite there! yes $row_rsUser['Percent'] is a percentage <?php $english_format_number = number_format($number); $number1 = $row_rsProd['P_Retail_Price']; $number2 = $row_rsUser['Percent']; if (isset($_SESSION['MM_Username'])) { $save = ($number2 / 100); }else{ $save = 1; } $retail = ($number1 * $save ); echo number_format ($retail / $save); ?> gives me You pay:£ 58, nearly there! Link to comment https://forums.phpfreaks.com/topic/52312-help-with-an-alternative-option/page/2/#findComment-258191 Share on other sites More sharing options...
MadTechie Posted May 21, 2007 Share Posted May 21, 2007 i'm a little confused.. $row_rsUser['Percent'] = 117.5% but 108.75 - 117.5% = -19.03 Link to comment https://forums.phpfreaks.com/topic/52312-help-with-an-alternative-option/page/2/#findComment-258209 Share on other sites More sharing options...
fazzfarrell Posted May 21, 2007 Author Share Posted May 21, 2007 sorry my fault I was looking at a different price so far I have <?php $english_format_number = number_format($number); $number1 = $row_rsProd['P_Retail_Price']; $number2 = $row_rsUser['Percent']; if (isset($_SESSION['MM_Username'])) { $save = ($number2); }else{ $save = 1; } $retail = ($number1); echo number_format ($save - $retail); ?> if the price was 57.5 I now get a result of 60! Link to comment https://forums.phpfreaks.com/topic/52312-help-with-an-alternative-option/page/2/#findComment-258214 Share on other sites More sharing options...
MadTechie Posted May 21, 2007 Share Posted May 21, 2007 use number_format($save - $retail, 2, '.', ''); as number_format will round up Link to comment https://forums.phpfreaks.com/topic/52312-help-with-an-alternative-option/page/2/#findComment-258222 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.