|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-09-22 16:51 UTC] uw@php.net
[2009-09-23 10:32 UTC] uw@php.net
[2009-09-25 13:58 UTC] lorenzo-99 at libero dot it
[2009-09-25 14:13 UTC] uw@php.net
[2009-09-25 15:06 UTC] lorenzo-99 at libero dot it
[2010-05-14 10:00 UTC] r dot wilczek at web-appz dot de
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 18:00:01 2025 UTC |
Description: ------------ I'm inserting a new record in a Mysql table with a PDO routine, the table have a double field (not specified the scale and size for the field), I'm using the bindValue function, I try to save the value 9.1234567 in the field, after the insert I found it saves 9.123457, so maximum 6 decimals (with rounding). The same problem happens with a float field, in this case it saves maximum 5 decimals I didn't try with other dbms, my Mysql version is 5.1.36 (i verified that the problem happens also with older versions) Reproduce code: --------------- This saves only 6 decimal (using bindValue): $sth = $dbh->prepare("INSERT INTO `intrapportal`.`regioni` ( `idRegione` ,`descrRegione` , `provadouble` ) VALUES ('xxxx', 'yyyyy', :value)"); /*** bind values ***/ $sth->bindValue(':value', 9.1234567, PDO::PARAM_STR); /*** execute the prepared statement ***/ $sth->execute(); This saves all decimals (without bindValue) $sth = $dbh->prepare("INSERT INTO `intrapportal`.`regioni` ( `idRegione` ,`descrRegione` , `provadouble` ) VALUES ('xxxx', 'yyyyy', 9.1234567)"); /*** execute the prepared statement ***/ $sth->execute();