PHP mysql bigint issue

前端 未结 3 1042
我寻月下人不归
我寻月下人不归 2020-12-19 17:16

I have two tables with bigint:

table1
id bigint(20) PK autoincrement
name varchar(40),
text

table2
id bigint(20) PK autoincrement
created datetime
text_fiel         


        
相关标签:
3条回答
  • 2020-12-19 17:54

    It's also the case that PHP under at least some 64-bit operating systems (eg FreeBSD AMD64) uses an 8-byte int, verifiable by testing with

    echo 'Size of int is '.PHP_INT_SIZE ;

    So if you're only going to be running a 64-bit operating system, you shouldn't need to manage the BIGINTs as strings in PHP.

    0 讨论(0)
  • 2020-12-19 18:00

    I solved this problem by change to another php version,that is changing from 64bit php version to 32bit php version. That really works for me.

    0 讨论(0)
  • 2020-12-19 18:03

    You need to CONVERT it to a string in SQL before getting it into PHP. In PHP, you can use GMP to handle the number.

    MySQL docs on converting: http://dev.mysql.com/doc/refman/5.7/en/cast-functions.html#function_convert

    0 讨论(0)
提交回复
热议问题