MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Jerry Schwartz Date:February 26 2009 1:53am
Subject:RE: [PHP] RE: non-auto increment question
View as plain text  
>Being rather new to all this, I understood from the MySql manual that
>the auto_increment is to b e used immediately after an insertion not
>intermittently. My application is for administrators (the site owner &
>designates) to update the database from and administration directory,
>accessed by user/password login... so there's really very little
>possibility of 2 people accessing at the same time.
>By using MAX + 1 I keep the id number in the $idIn and can reuse it in
>other INSERTS
[JS] Are you looking for something like LAST_INSERT_ID()? If you INSERT a
record that has an auto-increment field, you can retrieve the value that got
inserted with "SELECT LAST_INSERT_ID()". It is connection-specific, so
you'll always have your "own" value. You can then save it to reuse, either
as a session variable or (more easily) as a hidden field on your form.

Regards,
Jerry Schwartz
The Infoshop by Global Information Incorporated
195 Farmington Ave.
Farmington, CT 06032
860.674.8796 / FAX: 860.674.8341
www.the-infoshop.com
www.giiexpress.com
www.etudes-marche.com



>--
>
>Phil Jourdan --- pj@stripped
>http://www.ptahhotep.com
>http://www.chiccantine.com
>
>--
>MySQL General Mailing List
>For list archives: http://lists.mysql.com/mysql
>To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
>infoshop.com




Thread
Re: [PHP] RE: non-auto increment questionPJ26 Feb
  • RE: [PHP] RE: non-auto increment questionJerry Schwartz26 Feb
  • RE: [PHP] RE: non-auto increment questionJerry Schwartz26 Feb
    • Re: [PHP] RE: non-auto increment questionPJ26 Feb
      • RE: [PHP] RE: non-auto increment questionJerry Schwartz26 Feb
  • RE: [PHP] RE: non-auto increment questionGary W. Smith27 Feb
RE: [PHP] RE: non-auto increment questionJerry Schwartz26 Feb
Re: [PHP] RE: non-auto increment questionPJ26 Feb
RE: [PHP] RE: non-auto increment questionJerry Schwartz26 Feb
Re: [PHP] RE: non-auto increment questionPJ11 Mar