/    Sign up×
Community /Pin to ProfileBookmark

when values are sent from my shopping cart to the orders table it seems to be losing part of the value. for example:

if subtotal is 31.19 the grand total becomes 31.00

if subtotal is 119.99 grand total becomes 119.00

so it doesn’t seem to be rounding number just losing it.

any ideas why this might be happening?

i’m using float(6,2) if this makes any difference. is this to do with how db is set up or how its receiving it from php page?

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@NightShift58Feb 11.2007 — In your scripts, this type of SQL "dynamic building" happens a lot:[code=php] $updateSQL = sprintf("DELETE FROM tblCart WHERE cartID=%s AND productID=%s LIMIT 1" ,
GetSQLValueString($cartID, "int"),
GetSQLValueString($productID, "int")); [/code]
When you are inserting/updating [B]productSubtotal [/B]in [B]tblOrderPrducts [/B]or [B]orderTotal[/B] in [B]tblOrders[/B], you should ensure that the second parameter in GetSQLValueString() [B]isn't[/B] "int". It should be "double".
Copy linkTweet thisAlerts:
@sean1983ukauthorFeb 11.2007 — many thanks once again!
Copy linkTweet thisAlerts:
@NightShift58Feb 11.2007 — You're welcome!
×

Success!

Help @sean1983uk spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...