Getting last insert id?
| From: | Chris Payne | Date: | Wed, 08 Oct 2003 22:32:55 +0000 |
| Subject: | Getting last insert id? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-30910@lists.php.net to get a copy of this message | ||
Hi there everyone,
I use the below to insert some data into my database:
mysql_query ("INSERT INTO forummessages (Postedby, email, subject, message, ForumID, posted,
parentid)
VALUES ('$Postedby', '$email', '$subject',
'$message', '$ForumID','$posted','$parentid')
");
But once it has done this, I need to get the id it has generated in the DB and then update that
record with the id it generate, so how can I get the id from the above insert?
Any help would be greatly appreciated :-)
Regards
Chris