Re: mysql_insert_id()

From: Date: Sat, 07 Jul 2001 21:25:35 +0000
Subject: Re: mysql_insert_id()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-56678@lists.php.net to get a copy of this message
On 07-Jul-01 Chris Lambert - WhiteCrown Networks wrote: > I've used integer on many occasions with auto_increment, and have had no > problems. mysql_insert_id() returns the unique identifyer of the last record > inserted with mysql_query(). I'm not sure what "MySQL function" you're > referencing as an alternative, but you should be fine with an > integer/auto_increment/insert_id()... > PHP int values are signed integers, so when the database id > 2147483647 mysql_insert_id() will return negative values. On 32bit compile: INT = ok INT UNSIGNED will break at 50% of the domain (of valid id's) BIGINT ~2% BIGINT UNSIGNED ~1% I don't know if you can compile PHP for 64bit ... if you can then the first three should be fine. And you can always use mysql_query("select LAST_INSERT_ID()"); then treat the result as a string (which it is). Regards, -- Don Read dread@texas.net -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it.

« previous php.general (#56678) next »