[nycphp-talk] [Fwd: Re: mysql_insert_id Bug]

Hans Zaunere hans at
Wed Aug 13 09:22:52 EDT 2003

Just as followup to the mysql_insert_id() issue.  I've also attached the bk commit message that updated the mysql docs, and correctly indicates the actual behavior.


-------- Original Message --------
Subject: Re: mysql_insert_id Bug
Date: Wed, 13 Aug 2003 09:19:30 -0400
From: Hans Zaunere <hans at>
To: Boyd Lynn Gerber <bgerber at>
CC: bugs at
References: <Pine.SC5.4.44.0308121109450.26580-100000 at>

Boyd Lynn Gerber wrote:

> On Tue, 11 Aug 2003, Hans Zaunere wrote:
>>I may have stumbled on some either incorrect, or incorrectly documented,
>>behavior with
>>mysql_insert_id() and I'd like to hear some feedback.
>>"Note that mysql_insert_id() returns 0 if the previous query does not
>>generate an AUTO_INCREMENT
>>However, when inserting a non-unique value into a table with a UNIQUE
>>index, thus making
>>the INSERT fail and no AUTO_INCREMENT value being generated,
>>mysql_insert_id() returns
>>the value of the last successful INSERT statement.  I understand that this
>>is the correct
>>behavior for the SQL function LAST_INSERT_ID() (which is not reset between
>>however not for the C API function mysql_insert_id().
>>Please see below for a C program that illustrates this, as well as my
>>current environment.
>> Any insight would be helpful.  Thanks,
> The documentation is wrong.  We will get it updated

Thanks for looking into this.  I'll report this to the PHPdoc team so they can update as well.

Hans Zaunere
President, New York PHP
hans at

-------------- next part --------------
An embedded message was scrubbed...
From: Sergei Golubchik <serg at>
Subject: bk commit - mysqldoc tree (1.697)
Date: 13 Aug 2003 12:29:53 -0000
Size: 3259
URL: <>

More information about the talk mailing list