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 8362925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:03:22+00:00 2026-06-09T12:03:22+00:00

Using a decimal (I have tried variations of it) 0.5 is always converted to

  • 0

Using a decimal (I have tried variations of it) 0.5 is always converted to 5.

I can store 1.5, etc, no problem… Just curious on how I need to set up my data type to correctly store a ‘0.5’ number.

Thanks

EDIT:

The current data type is Decimal (3,1). I have tried float as well.

I simply retreive the number through $_POST from a Form text box which is restricted to numbers only through Java. I never considered that maybe the browser is simply sending it as a 5, I don’t know.

EDIT 2: I have confirmed through echo that the 0.5 is sent fine, it’s once it gets into the database that it becomes 5

  • 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-06-09T12:03:23+00:00Added an answer on June 9, 2026 at 12:03 pm

    You know, I might get voted down for this, but I’ve always had success (as a sort of hack) in storing values like this as a VARCHAR and then using format() function in PHP when I need to make calculations. MySQL still seems to parse it well enough for SQL functions as well. Just my 2 cents 🙂

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

Sidebar

Related Questions

I have a problem converting a string binary to a decimal I was using
I have a TSQL SELECT that can return a null. I tried using ISNULL
I have some columns in a data store using 12 decimal precision. I want
I have to validate using regex decimal number between 00.00 to 35.35 with following
I have to convert a decimal number to octal and hexadecimal using bitwise operations.
Using GMP on c, I have a big integer mpz_t n in decimal form,
I have a class with a decimal property & I'm serializing & deserializing using
Im using the following method to add up text boxes. I have tried changing
I tried this code using the decimal standard library module : >>> from decimal
I'm using decimal type (.net), and I want to see if two numbers are

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.