PHP 4.0 Bug #6675: mysql_insert_id returns incorrect size for BIGINT fields
| From: | danbeck at dealnews dot com | Date: | Tue, 12 Sep 2000 08:54:10 +0000 |
| Subject: | PHP 4.0 Bug #6675: mysql_insert_id returns incorrect size for BIGINT fields | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-32960@lists.php.net to get a copy of this message | ||
From: danbeck@dealnews.com
Operating system: Linux (redhat 6.1)
PHP version: 4.0.0
PHP Bug Type: MySQL related
Bug description: mysql_insert_id returns incorrect size for BIGINT fields
If you have a table with an auto_increment BIGINT field:
CREATE TABLE bigtest (
id bigint(20) NOT NULL auto_increment,
PRIMARY KEY (id)
);
and the last ID you inserted was larger than 32 bits:
i.e. 293949384923
If you insert a new record using:
insert into bigtest values (null);
mysql_insert_id() will return an incorrect number usually negative. It looks like it's storing
that large (64bit) number in a 32bit field of some sort before returning it to the caller.