13 Jun
2003
13 Jun
'03
8:45 p.m.
Davis Mr MR wrote at 2003-6-12 17:11 +0100:
I'm trying to push the last_inset_id from an Insert statement onto the request namespace, so I can pick it up and retrieve the new record for display.
My ZSQL method looks like this.
INSERT INTO suppliers (insert statements removed) <dtml-var sql_delimiter> SELECT last_insert_id() AS lastinsertid <dtml-call "REQUEST.set('id',lastinsertid)">
It comes back with a NameError - global name 'lastinsertid' is not defined.
The results of ZSQL methods are not automatically added to the DTML namespace. You can use <dtml-with expr="your_ZSQL_Method()[0]"> ... </dtml-with> to push the first result row onto the DTML namespace ("during" the with). Dieter