php - MySql converts a floating value into integer when recording on a float field on DDBB -
i have update query:
update ws_users set us_credits='251181.5' us_id=2;
the us_credits
field, can see floating field default value of zero:
every update query trying set floating value us_credits
results on integer, example, query first typed results on 251182 record on field.
if try make manual change record seen above, neither records floating value, integer (251184 in case):
mysql permits nonstandard syntax: float(m,d) or real(m,d) or double precision(m,d). here, “(m,d)” means values can stored m digits in total, of d digits may after decimal point.for example, column defined float(7,4) -999.9999 when displayed. mysql performs rounding when storing values, if insert 999.00009 float(7,4) column, approximate result 999.0001.
https://dev.mysql.com/doc/refman/5.0/en/floating-point-types.html
so need define column handing decimal points also.
Comments
Post a Comment