here is a function i added to my pear DB abstraction class function lastinsertID(){ $id = mysql_insert_id($this->connection); return $id; }
-----Original Message----- From: Mark Stringham [mailto:mstringham@;edeasolutions.com] Sent: Monday, November 11, 2002 8:54 PM To: [EMAIL PROTECTED] Subject: Re: Get last auto incremented id - newbie > > Howdy - > > I wonder if there is an more efficient way to do the following: > I have 2 tables - > > The user submits a new record into table A and an id (primary key) is > created using the auto-increment. > At the time that the new record is created in table A I need to insert the > newly created id from table A into a column in table B. Is there a way to do > this without performing multiple queries to either table? > > Any help is appreciated > > Thanks > > Mark > sql,query > --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php