MySQL: Insert float, ends up an int

floating-point, insert, int, mysql, types

Solution

A float value only has about seven digits of precision, so the value will be truncated to `140834.0` when you store it, and that is displayed as `140834`.

If you want to store the number with higher precision, use the `double` type instead.

Problem

I've got a float variable that I'm trying to insert into a float column in my database. The query is as follows: ``` UPDATE users set earnings_unconfirmed = 140834.005336 WHERE username = 'test' ``` I have verified that the column is set to float. However when I insert it, it ends up as an int: Am I missing something trivial here?

Original source