List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:January 30 2002 12:47am
Subject:Re: next insert id
View as plain text  
At 15:30 -0800 1/29/02, laszlo wrote:
>And then you hope that between 'insert' and 'select' nobody else inserted
>another record?

Only for the last method.  The first two return client-specific values.

>
>laszlo
>
>Johnny Withers wrote:
>
>>  INSERT into the table
>>  then SELECT last_insert_id()
>>
>>  or when using php
>>
>>  query(INSERT QUERY)
>>  $last_id=mysql_insert_id()
>>
>>  OR
>>
>>  INSERT
>>  SELECT MAX(id) FROM tablename
>>
>>  assuming id is the auto incremnt field.
>>
>>  ---------------------
>>  Johnny Withers
>>  johnny@stripped
>>  p. 601.853.0211
>>  c. 601.209.4985
>>
>>  -----Original Message-----
>>  From: Joel Wickard [mailto:jwickard@stripped]
>>  Sent: Tuesday, January 29, 2002 7:04 PM
>>  To: mysql@stripped
>>  Subject: next insert id
>>
>>  database,sql,query,table
>>
>>  I need to find out what the next value will be in an auto_increment
>>  field
>>  will be. could someone help me out with the select statement?
>>
>>  ---------------------------------------------------------------------
>>  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 <mysql-thread97914@stripped>
>>  To unsubscribe, e-mail
>>  <mysql-unsubscribe-johnny=mindbender.net@stripped>
>>  Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>>
>>  ---------------------------------------------------------------------
>>  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 <mysql-thread97918@stripped>
>>  To unsubscribe, e-mail
> <mysql-unsubscribe-lnadai=jnet1.com@stripped>
>>  Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>
>---------------------------------------------------------------------
>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 <mysql-thread97925@stripped>
>To unsubscribe, e-mail <mysql-unsubscribe-paul=snake.net@stripped>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Thread
next insert idJoel Wickard30 Jan
  • Re: next insert idJames Montebello30 Jan
    • Re: next insert idNathan30 Jan
      • Re: next insert idChristopher Thompson30 Jan
    • Re: next insert idChristopher Thompson30 Jan
      • Re: next insert idJames Montebello30 Jan
        • Re: next insert idPaul DuBois30 Jan
    • Re: next insert idPaul DuBois30 Jan
      • Re: next insert idJames Montebello30 Jan
        • RE: next insert idRoger Baklund30 Jan
        • Re: next insert idPaul DuBois30 Jan
  • RE: next insert idJohnny Withers30 Jan
    • Re: next insert idlaszlo30 Jan
      • Re: next insert idPaul DuBois30 Jan
  • Re: next insert idPaul DuBois30 Jan
    • Re: next insert idPaul DuBois30 Jan
      • Re: next insert idJames Montebello30 Jan
        • Re: next insert idPaul DuBois30 Jan
        • Re: next insert idDL Neil30 Jan
          • Re: next insert id (slightly OT)William R. Mussatto30 Jan
            • Re: next insert id (slightly OT)DL Neil30 Jan
              • Re: next insert id (slightly OT)William R. Mussatto30 Jan