Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6240103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:30:22+00:00 2026-05-24T11:30:22+00:00

So here is my issue, We are trying to put pricing into our database

  • 0

So here is my issue, We are trying to put pricing into our database but for some reason it converts 10.00 to 10 OR 10.50 to 10.5 it keeps it just chops off the trailing zeroes….

I checked the SQL statement and it says price=10.00 …. so Im really confused as to why/where it is stripping the .00

Ive checking all the way through where we enter the number to the final step at the INSERT or UPDATE and it keeps the trailing zeroes all the until the UPDATE or INSERT and then when you check the table …the zeroes are dropped

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T11:30:23+00:00Added an answer on May 24, 2026 at 11:30 am

    are you using a decimal(N,2) type, or similar, for storing the data? if not, then this is normal behaviour. see http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html

    please, don’t follow the advice in another answer and leave this to your presentation layer. do the job properly and store the exact decimal value. that way you avoid rounding issues.

    ps there’s also the separate issue of how the value is managed in whatever language you are using. hopefully it uses a special type that includes appropriate formatting. if not, then you may want to worry about how you handle the value in your code (one possibility is to multiple by 100 and use an integer number of cents, but then you need to take care that maths rounds correctly – this is complicated, but it’s complicated for a reason; if you just stuff everything in doubles it will likely be simple, but have some strange bug for certain values…)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to put some loooong text into an AlertDialog. The only issue
I've ran into an issue while trying to put together a Grails app with
I'm trying to put a user provided date into an SQL database, and I
My issue here is quite simple : i'm trying to use the jQuery validate
I'm having an issue here, I am trying to get all the titles from
Hey all, here is the issue I am currently trying to work through. We
I am going nuts here trying to resolve a cascading update/delete issue :-) I
I am having some issues trying to convert a double to C++ string. Here
I'm trying to migrate to ASP.Net MVC 2 and meet some issues. Here is
Having an issue here that I have tried everything I can think of but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.