Re: Help with MySql float
| From: | Tobias Franzén | Date: | Sun, 17 Feb 2008 16:22:09 +0000 |
| Subject: | Re: Help with MySql float | ||
| References: | 1 2 3 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-44613@lists.php.net to get a copy of this message | ||
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