Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/235.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 为什么我的19位数字会四舍五入到17位_Php_Mysql_Json - Fatal编程技术网

Php 为什么我的19位数字会四舍五入到17位

Php 为什么我的19位数字会四舍五入到17位,php,mysql,json,Php,Mysql,Json,我得到的交易编号是6316732587130745043(19位)。 由于整数不够,我在mysql数据库中使用十进制(50,0) 但是,数据库中的值为6316732587130745000(四舍五入到17位) 我从服务器请求中获取了事务号: $sendInfo = file_get_contents($server.$request); $obj_sendInfo = json_decode($sendInfo); $transaction = $obj_sendInfo->{'trans

我得到的交易编号是
6316732587130745043
19位
)。 由于整数不够,我在mysql数据库中使用十进制(50,0)

但是,数据库中的值为6316732587130745000(
四舍五入到17位)

我从服务器请求中获取了事务号:

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

如何修复此问题?

使用
bigint
数据类型。8字节的存储空间。这就是它的意义所在。二进制非浮点、精简和平均存储

create table ph345
(
    bi bigint not null
);
insert ph345(bi) values (6316732587130745043);
从ph345中选择*

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

Mysql手册页面上的

您必须指定整数部分和小数部分的长度,检查其当前值。。。示例DECIMAL(25,2)为什么要对事务编号使用DECIMAL类型?你打算做算术吗?要不然,为什么不用绳子呢?非常感谢!这正是我要找的。很乐意帮忙。现在,将您的一些问题标记为绿色复选标记:)当更改为biginit使$transaction的最后两位不再为“00”时,它在最后三位中包含错误的值。php中一定还有问题。我仍然无法找到解决方法。有人能帮忙吗?