List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:June 1 1999 11:23am
Subject:Re: mysql_insert_id()
View as plain text  
At 12:45 PM +0200 6/1/1999, Matthias Pigulla wrote:
>Hi folks,
>
>I'm currently facing a little problem with the C API's mysql_insert_id()
>function. I'll have to check it a bit more thoroughly, but right now it
>seems to me as if
>
>- it would return the correct auto_incremented value after an INSERT,
>- but after performing a second INSERT into another table with the use
>of LAST_INSERT_ID() funcion   in the query itself, it returns 0,
>although no new auto_incrementing table hat been touched.
>
>Am I doing sth wrong, is this the intended behaviour? The manual says
>"returns the id that was most recently generated", so I expected the
>value to remain visible.


Yes, it should remain visible.  The 0 return should happen only if you
haven't generated an AUTO_INCREMENT value during the course of the
connection yet.  Are you performing both INSERTs during the same connection,
or have you perhaps disconnected and reconnected?


>
>BTW, I am using a 3.22.22 client with a 3.22.16gamma (remote) server. If
>you find it necessary (and it's not a problem on my side), I'll post
>some code to check this out.
>
>Matthias
>--
>   w e b f a c t o r y | matthias pigulla
>      www.webfactory.de  mp@stripped

--
Paul DuBois, paul@stripped
Northern League Chronicles: http://www.snake.net/nl/
Thread
mysql_insert_id()Matthias Pigulla1 Jun
  • Re: mysql_insert_id()Paul DuBois1 Jun
    • Re: mysql_insert_id()Matthias Pigulla3 Jun
      • Re: mysql_insert_id()Paul DuBois3 Jun
    • Re: mysql_insert_id()Jim Faucette3 Jun
    • Re: mysql_insert_id()Matthias Pigulla3 Jun
      • Re: mysql_insert_id()Benjamin Pflugmann3 Jun
        • Re: mysql_insert_id()Michael Widenius3 Jun
          • Re: mysql_insert_id()Paul DuBois3 Jun
    • Re: mysql_insert_id()Matthias Pigulla3 Jun
    • Re: mysql_insert_id()Matthias Pigulla3 Jun
      • Re: mysql_insert_id()Michael Widenius3 Jun