質問

I have a mysql float field x. If I insert a value from PHP script 21.10 it saves as 21.1 .But my system treat 21.10 and 21.1 are different. So How can I prevent mysql from discarding last zero bit?

役に立ちましたか?

解決

The field in MySQL table should be of type Decimal (X,Y) where X is total digits and Y is the number of those digits that should be on the fractional side.

Example of what you need

DECIMAL(10, 2) has 8 digits onthe integer part and 2 digits on the fractional part.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top