another insert/select for multiple tables... (or, determining previous auto-increment ID)

2004-09-01 Thread Eve Atley
The question: Is there anything in MySQL that will allow me to determine, accurately, the last auto-incremented field from a particular database, so I can then insert based upon this into another table? What if 2 users input at the same time? Please see the 'long explanation' for further

Re: another insert/select for multiple tables... (or, determining previous auto-increment ID)

2004-09-01 Thread SGreen
Since you should still have the same information that you used to create your entry in the candidate table you can do something like: SELECT @candidateID := Candidate_ID FROM candidate WHERE Last_Name = '$lastname' AND First_Name = '$firstname' AND Middle_Initial = '$middle'

Re: another insert/select for multiple tables... (or, determining previous auto-increment ID)

2004-09-01 Thread Michael Stassen
Yes, LAST_INSERt_ID(). It's connection-specific, not db-specific. Because it is connection-specific, your 2-users issue is avoided. See the manual for the details http://dev.mysql.com/doc/mysql/en/Getting_unique_ID.html. Michael Eve Atley wrote: The question: Is there anything in MySQL that