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:

im

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):

img

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

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -