Freedom-n-Democrazy Posted October 9, 2011 Share Posted October 9, 2011 Whats wrong with this arithmetic code? $sizestotal = $content['sizes'] * $row['price']; $sizeltotal = $content['sizem'] * $row['price']; $sizeltotal = $content['sizel'] * $row['price']; $sizeltotal = $content['sizexl'] * $row['price']; $idtotal = $sizestotal + $sizemtotal + $sizeltotal + $sizexltotal; $total += $idtotal; Link to comment https://forums.phpfreaks.com/topic/248737-need-help-from-a-php-accountant-lol/ Share on other sites More sharing options...
awjudd Posted October 9, 2011 Share Posted October 9, 2011 You keep overwriting the same variable ($sizeltotal). Please Note: this is a very easy thing to find through debugging using print statements ... i.e. echo each of the values you are totaling up and see what they actually are. Instead of coming here for us to debug it for you. ~juddster Link to comment https://forums.phpfreaks.com/topic/248737-need-help-from-a-php-accountant-lol/#findComment-1277421 Share on other sites More sharing options...
Freedom-n-Democrazy Posted October 9, 2011 Author Share Posted October 9, 2011 Yeah, I know I just noticed that. Well, I went over the code about 10 times. Please note: This is a help forum. Thanks. Link to comment https://forums.phpfreaks.com/topic/248737-need-help-from-a-php-accountant-lol/#findComment-1277428 Share on other sites More sharing options...
awjudd Posted October 9, 2011 Share Posted October 9, 2011 Yes it is a help forum, but we assume you have done your due diligence in doing at least some debugging beforehand. ~juddster Link to comment https://forums.phpfreaks.com/topic/248737-need-help-from-a-php-accountant-lol/#findComment-1277431 Share on other sites More sharing options...
Freedom-n-Democrazy Posted October 9, 2011 Author Share Posted October 9, 2011 Going over the code 10 times is due diligence. Link to comment https://forums.phpfreaks.com/topic/248737-need-help-from-a-php-accountant-lol/#findComment-1277432 Share on other sites More sharing options...
awjudd Posted October 9, 2011 Share Posted October 9, 2011 Echoing variables is due diligence and stepping through each to see what the values are is due diligence. Reading over code it is incredibly easy to miss. ~juddster Link to comment https://forums.phpfreaks.com/topic/248737-need-help-from-a-php-accountant-lol/#findComment-1277436 Share on other sites More sharing options...
Freedom-n-Democrazy Posted October 9, 2011 Author Share Posted October 9, 2011 Your right. Next time.. Link to comment https://forums.phpfreaks.com/topic/248737-need-help-from-a-php-accountant-lol/#findComment-1277438 Share on other sites More sharing options...
premiso Posted October 9, 2011 Share Posted October 9, 2011 Please note: This is a help forum. Thanks. Wtf since when? Link to comment https://forums.phpfreaks.com/topic/248737-need-help-from-a-php-accountant-lol/#findComment-1277477 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.