What's the best way to get the primary key of a row just inserted into a
mySQL database?

    If the primary key is autoincrement, I insert a row.  It's successful,
but now how to do I read back the key of this table?

    Right now I'm adding a md5 hash of the session id into the row I'm
inserting, and then will read that row back.  But this seems clunky....

    Should I just go for a "keytable" approach?  Where I have a no
autoincrement fields and just a table that holds the key value for each
table.  When I insert a row, I lock the row of the keytable I'm inserting
int, update it's value, write it back, then use that key to insert into the
main table?

Grant Boggs

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to