문제

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