RE: [PHP-DB] Getting last insert id?
| From: | Omelin Morelos | Date: | Wed, 08 Oct 2003 23:30:32 +0000 |
| Subject: | RE: [PHP-DB] Getting last insert id? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-30913@lists.php.net to get a copy of this message | ||
you can use the mysql_insert_id() function.
-----Mensaje original-----
De: Jeff Shapiro [mailto:lists@nensha.com]
Enviado el: Wednesday, October 08, 2003 4:17 PM
Para: Chris Payne
CC: php-db@lists.php.net
Asunto: Re: [PHP-DB] Getting last insert id?
Well, that all depends on which db server you are using.
On Wed, 8 Oct 2003 18:32:55 -0400, Chris Payne spoke thusly about
[PHP-DB] Getting last insert id?:
> 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
---
Listserv only address.
Jeff Shapiro
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php