RE: RE: non-auto increment question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>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@xxxxxxxxxxxxx
>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=jschwartz@the-
>infoshop.com





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux