为什么我的19位数字将四舍五入为17位

时间:2015-09-24 04:46:11

标签: php mysql json

我的交易号为631673258713074504319 digits)。 由于Integer不够,我在我的mysql数据库decimal(50,0)

中使用

但是,数据库中的值为6316732587130745000rounded to 17 digits

我从服务器请求中获得了交易号:

$sendInfo = file_get_contents($server.$request);
$obj_sendInfo = json_decode($sendInfo);
$transaction = $obj_sendInfo->{'transaction'};

我该如何解决?

1 个答案:

答案 0 :(得分:2)

使用bigint数据类型。我相信8字节的存储空间。这就是它的意思。二进制不浮点,精益和平均存储。

create table ph345
(
    bi bigint not null
);
insert ph345(bi) values (6316732587130745043);

从ph345中选择*;

+---------------------+
| bi                  |
+---------------------+
| 6316732587130745043 |
+---------------------+

Numeric Types

上的Mysql手册页