Pregunta

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?

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top