[Zope] setting variable
Paulo Eduardo Neves
neves@inf.puc-rio.br
Tue, 16 Mar 1999 19:45:29 -0300
Tom Jenkins wrote:
>
> Hello folks,
> I'm stuck on a problem which I hope some one could help me with. I
> have a database entry form where the user will enter in information for
> two related tables. When she submits the form, I want to first post one
> tables information, then call another sql method to get the id generated
> for that post, then take that value and add it to the REQUEST object
> and pass it to the second sql insert for inserting to the second table
> (along with some other parts of the REQUEST object from the form).
Do you really need this? You can put more than one sql commands in a sql
method, you just have to put a <!--#var sql_delimiter --> between them.
You can insert in the two tables with just one method. The
last_insert_id() should be in the values field of the second insert.
Take a look at the code genereated by the sql wizard in the contrib
page.
>
> I'm planning on using MySQL that has a special select:
> select LAST_INSERT_ID()
> to return the last auto-generated id value to get the id.
>
> I know you can add a variable to the REQUEST object via
> <!--#call "REQUEST.set('varname', value)"-->
> but how to I get the value from the sql method? The only way I know
> now is via #var tags but you can't nest the DTML.
Take a look at the other thread.
[]s
--
Paulo Eduardo Neves
PUC-Rio de Janeiro
Pager: Central: 292-4499 cod. 213 99 64
ou use a URL: http://www.learn.fplf.org.br/neves/mensagempager.html