How do i find MySQL inserted primary key?
| From: | phobo | Date: | Sun, 18 Feb 2001 12:14:38 +0000 |
| Subject: | How do i find MySQL inserted primary key? | ||
| References: | 1 2 3 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-6725@lists.php.net to get a copy of this message | ||
if i do an insert statement where i let MySQL assign the (autoincrementing)
primarykey, how do i find out the primary key of the record i just inserted?
siggy
----- Original Message -----
From: "Thies C. Arntzen" <thies@thieso.net>
To: "Brian Lalor" <blalor@hcirisc.cs.binghamton.edu>
Cc: <php-db@lists.php.net>
Sent: Monday, February 19, 2001 1:02 AM
Subject: Re: [PHP-DB] OCI8 error problems
> On Thu, Feb 15, 2001 at 10:07:23AM -0500, Brian Lalor wrote:
> > On Thu, 15 Feb 2001, Thies C. Arntzen wrote:
> >
> > > how should it?
> > >
> > > you would have to pass in the correct statement|connection
> > > handle - elsewise it simply won't work!
> >
> > Ok, that was a cobbled-up code snippet; replace $this->conn with $conn,
> > and $statement with $s.
> >
> > It still doesn't work...
>
> <?
> $db = ocilogon('tc','tc');
> $stmt = ociparse($db,"insert into uni values (1)");
> $success = @ociexecute($stmt);
> if (! $success) {
> var_dump(ocierror($stmt));
> }
> ?>
>
> works for me.
>
> tc
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>