Jump to content

hveing problems with costs adding up


fazz

Recommended Posts

I have a shopping cart, and each client that logs on has a budget spend -  am testing it with a budget of 5000.

 

So I have created this that works until the toal goes past 999

 

 

<?php
		  $Budget = $HTTP_GET_VARS['Budget'];
		  $TotalCart = $HTTP_SESSION_VARS["icNamco"]->col("Total");
		  echo number_format ($Budget - $TotalCart);
		  ?>

 

It deducts and gives me the correct total until it goes over 999 and the reverts to displaying 4,999

 

 

Can any one shine any light on this!

 

Merry christmas to everyone!

Link to comment
https://forums.phpfreaks.com/topic/82037-hveing-problems-with-costs-adding-up/
Share on other sites

I have now found this and changed my code

<?php
				//Add up toal items and - from Budget cost: does not work correctley over 999.00
              $Budget = $HTTP_GET_VARS['Budget'];
		  $TotalCart = $HTTP_SESSION_VARS["icNamco"]->col("Total");
              $BudgetRemain = $Budget - $TotalCart;
		  echo number_format ($BudgetRemain, 0, "", ",");
		  ?>

 

I now have a budget of 485 when I add a total of 595 into my cart it says the remaining budet is '-110'

 

I add a second item of 415 and then the toal says £484 instead of - 594 I just can't seem to work it out?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.