[Zope] ZSQL-Methods: last inserted id

Jonothan Farr jfarr@real.com
Wed, 17 May 2000 17:05:02 -0700


> I wonder how I can find out about the last inserted id of a row in my
> mysql-database, which I inserted through a ZSQL-Method...
> 
> I tried mysql's built-in function LAST_INSERT_ID(), but that did not solve
> my problem...


It should. Create a DTML method called, say 'select_last_id':

select LAST_INSERT_ID() AS id;

then from dtml:

<dtml-in select_last_id>
This is the last inserted id: <dtml-var id>
</dtml-in>

--jfarr

"Perl is worse than Python because people wanted it worse."
Larry Wall, 14 Oct 1998