List:General Discussion« Previous MessageNext Message »
From:Dan Nelson Date:February 2 2003 8:16pm
Subject:Re: last_insert_id() returns 0 in windows
View as plain text  
In the last episode (Feb 01), Alan said:
> Okay, I've seen just about every question on last_insert_id(), except
> this one:
> I am running MySQL on Win XP and when I generate a test table (test)
> with an AUTO_INCREMENT column (aid) and a second column (a) then use
> an insert statement like: INSERT INTO test (a) values (1); then:
> SELECT LAST_INSERT_ID(); I get a return value of 0.  I considered the
> fact that maybe my connection is closing, but when I create the same

Are you running these commands from the mysql CLI prompt, or are you
using some other tool?  If you aren't using the CLI, what does the
query "SELECT CONNECTION_ID()" return just before your insert and just
after your "SELECT LAST_INSERT_ID()" ?  If they are different, your
tool is probably opening a new connection for every command you send,
and you need to use a different tool :)

	Dan Nelson
last_insert_id() returns 0 in windowsAlan1 Feb
  • Re: last_insert_id() returns 0 in windowsDan Nelson2 Feb
  • Re: Re: last_insert_id() returns 0 in windowsNasser Ossareh2 Feb