PJ wrote:
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
The real way of doing this is via a facility in the sql standard called SEQUENCE. Libraries like ADOdb emulate this for MySQL which does not support it. The method provides a unique series of numbers, so that if two people are adding things they do not get the same one. As has been pointed out, AUTOINC only knows the number after the event, but often you DO need to know the number to populate the detail tables, and while writing the master and getting the 'last_id' can work, a simple call to get the next value of the sequence is tidier.
-- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php