Re: Help with MySql float

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Velen wrote:
Hi Guys,

When inserting a value like 123567.8956 in my table it is rounding it to 2
decimal place.  The field type is set as float.

Can anyone tell me why it's not taking all the decimals? and How to insert
the number with all the decimals?

Thanks

Velen

Hello Velen,

Your question seem purely related to MySQL. Not very PHP related. Anyway...

It depends on your version of MySQL. Check the documentation for Numeric Types. It says you can specify the number of decimals you want to store, something like FLOAT(max_digits,precision). If you need more precision, there's also the DOUBLE PRECISION.

If your MySQL column is specified for higher precision already, then it could be a PHP issue. Is this the case?

For MySQL => 5.0
http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html

For MySQL < 5.0
http://dev.mysql.com/doc/refman/4.1/en/numeric-types.html


/Tobias

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux