mySQL getting primary key of the last added record
| From: | jeff marston | Date: | Wed, 22 Nov 2000 03:38:50 +0000 |
| Subject: | mySQL getting primary key of the last added record | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-4635@lists.php.net to get a copy of this message | ||
Here's my problem:
I'm trying to insert a record into a table, then redirect to a page that
shows information about that record. I do the INSERT INTO tblname VALUES
(...), and let mySQL assign an auto_incrementing primary key ID field. Does
php have a function (like mysql_affected_rows(), I guess) that can tell you
about the last record that was inserted? Or maybe it's in mySQL -- I've
done something like this with SQL Server 7. Or maybe there's an easy
workaround that I'm missing.
Any help? Thanks!
// jeff