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 [EMAIL PROTECTED] --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php