Inserting and retrieving id

Inserting and retrieving id

am 29.06.2004 16:34:52 von Jan Eden

Hi,

I have a subroutine which updates and inserts edited/new rows into my datab=
ase.

Afterwards, I want it to display the edited/new row. This is easy in case o=
f an edited row, since I have an id to refer to:

if ($id) { $dbh->do("UPDATE items $set_clause WHERE item_id =3D $id"); }
else { $dbh->do("INSERT INTO items $set_clause"); }

print $q->redirect("media.pl?mode=3Dget_changed&id=3D$id&m edia_type=
=3D$media_type");

But how can I get the id (INT PRIMARY KEY AUTO_INCREMENT) immediately after=
inserting new data? Is there a good way to return such a value upon insert=
ion?

Thanks,

Jan
--=20
Either this man is dead or my watch has stopped. - Groucho Marx

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=3Dgcdmp-msql-mysql-modules @m.gmane.org